Here is the code for a 1.5x scaler Ayla wrote for Ohboy. You can use it in Gambatte if you want.

`/*Ayla's 1.5x Upscaler - 160x144 to 240x216 */`

/* Before:

* a b c d

* e f g h

*

* After (parenthesis = average):

* a (a,b) b c (c,d) d

* (a,e) (a,b,e,f) (b,f) (c,g) (c,d,g,h) (d,h)

* e (e,f) f g (g,h) h

*/

void ayla_scale15x(uint32_t *to, uint32_t *from){

uint32_t reg1, reg2, reg3, reg4, reg5;

size_t x, y;

for (y=0; y<216/3; y++) {

for (x=0; x<240/6; x++) {

__builtin_prefetch(to+4, 1);

// Read b-a

reg1 = *from;

reg5 = reg1 >> 16;

reg2 = (reg1 & 0xf7de0000) >> 1;

reg1 &= 0xffff;

reg1 |= reg2 + ((reg1 & 0xf7de) << 15);

// Write (a,b)-a

*to = reg1;

reg1 = (reg1 & 0xf7def7de) >> 1;

// Read f-e

reg3 = *(from++ + 160/2);

reg2 = reg3 >> 16;

reg4 = (reg3 & 0xf7de0000) >> 1;

reg3 &= 0xffff;

reg3 |= reg4 + ((reg3 & 0xf7de) << 15);

// Write (e,f)-e

*(to + 2*320/2) = reg3;

reg3 = (reg3 & 0xf7def7de) >> 1;

// Write (a,b,e,f)-(a,e)

*(to++ + 320/2) = reg1 + reg3;

// Read d-c

reg1 = *from;

// Write c-b

reg5 |= (reg1 << 16);

*to = reg5;

reg5 = (reg5 & 0xf7def7de) >> 1;

// Read h-g

reg3 = *(from++ + 160/2);

// Write g-f

reg2 |= (reg3 << 16);

*(to + 2*320/2) = reg2;

reg2 = (reg2 & 0xf7def7de) >> 1;

// Write (c,g)-(b,f)

*(to++ + 320/2) = reg2 + reg5;

// Write d-(c,d)

reg2 = (reg1 & 0xf7def7de) >> 1;

reg1 = (reg1 & 0xffff0000) | ((reg2 + (reg2 >> 16)) & 0xffff);

*to = reg1;

reg1 = (reg1 & 0xf7def7de) >> 1;

// Write h-(g,h)

reg2 = (reg3 & 0xf7def7de) >> 1;

reg3 = (reg3 & 0xffff0000) | ((reg2 + (reg2 >> 16)) & 0xffff);

*(to + 2*320/2) = reg3;

reg3 = ((reg3 & 0xf7def7de) >> 1);

// Write (d,h)-(c,d,g,h)

*(to++ + 320/2) = reg1 + reg3;

}

to += 2*360/2;

from += 160/2;

}

}