GP32 VBA32 Resolution


ardnut

Still Fresh
Joined
Oct 17, 2003
Messages
31
I've had a quick look through the source code for vba32 and I'm a bit confused why gba games run at 320x240 (the gp32 max res). The actual gba has a screen res of 240x160 and in the code it lists this (vba32.c):

if(cartridgeType == 0) {
srcWidth = 240;
srcHeight = 160;
systemFrameSkip = frameSkip;
}
else if (cartridgeType == 1) {
srcWidth = 160;
srcHeight = 144;
gbBorderLineSkip = 160;
gbBorderColumnSkip = 0;
gbBorderRowSkip = 0;
systemFrameSkip = gbFrameSkip;
} else {
srcWidth = 320;
srcHeight = 240;
}


So the screen width/height is adapted based on which type of rom is loaded. If the cartridgeType is set to 0 then it runs at the gba res of 240x160, which makes sence. So in the following code this is set (vba32.c):


if(vba32_rom_type == IMAGE_GBA) {
int size = CPULoadRom(szFile);
failed = (size == 0);
if(!failed) {
cartridgeType = 0;
emuWriteState = CPUWriteState;
emuWriteMemState = CPUWriteMemState;
emuReadState = CPUReadState;
emuReadMemState = CPUReadMemState;
emuWriteBattery = CPUWriteBatteryFile;
emuReadBattery = CPUReadBatteryFile;
emuReset = CPUReset;
emuCleanUp = CPUCleanUp;
emuWritePNG = CPUWritePNGFile;
emuWriteBMP = CPUWriteBMPFile;
emuMain = CPULoop;
emuUpdateCPSR = CPUUpdateCPSR;
emuHasDebugger = true;
emuCount = 50000;

if(removeIntros && rom != NULL) {
WRITE32LE(&rom[0], 0xea00002e);
}
CPUInit(NULL, useBios); //biosFileName, useBios);
systemFrameSkip=9;
CPUReset();
/*
if(sdlAutoIPS) {
int size = 0x2000000;
}
*/
}


Do you think its the rom type detection thats not working? as all the gba roms I load are displayed at 320x240. Im sure a slight speed gain would be seen if the roms were not stretched to fullscreen and instead ran at their original res. I would edit the code myself, so that the else statement in the first code listing defaulted to 240x160, but I'm unsure of what I need to set up a dev environment to be able to compile the code.

Does anyone want to have a go at making this code change? or better still could you point me in the right direction of how to setup something like ms vc++ to be able to compile the code.

Thanks.
 
Last edited by a moderator:
Newest SDL for GP32 supports asm-scaled GameBoy resolution (160x144) and GameBoy Advanced resolution (240x160).
 
chui could you please release a quick updated version of vba32 that runs gba games in the native res of 240x160, or allows you to select if you want the screen stretched to 320x240 or not.

I take it that I'm right in assuming that running gba roms at 240x160 instead of 320x240 would produce some form of performance increase?
 
Lttle optimization, asm-scaled is (approximately) same speed; better porting to ads compiler and use other cpu/gfx cores with assembler.
Sorry, i've left this development.
 
first thank chui for this great port!
but a option or a version with native resolution would be great, and an 150mhz option, what should be easy to make...
Thanks

bye
 
Thanks Chui
I tried to compile it using debian after installing stuff from http://sdl-gp32.sourceforge.net/and it I get messages about missing memory.h
I made an empty file called memory.h
and it compiles
with many messages about interworking
but still I could not get to the load menu crashes somewhere around here
GpFatInit();

text_draw_window(96,64,140,32,"-------");
write_text(14,9,"Please wait");
SDL_Flip(text_screen);

if ((strcmp(dir,"gp:\\"))&&(strcmp(dir,"GP:\\"))&&(strcmp(dir,"\\"))&&(strlen(dir)))
{
---> GpRelativePathSet(dir);
if ( GpDirEnumNum(".", &tmp)!=SM_OK )
return -1;
}
else
{
if ( GpDirEnumNum("gp:\\", &tmp)!=SM_OK )
return -1;
}
Any ideas why ?
 
changed the -mno-interwork to -minterwork.. in the make file. get less warnings but still crashes the same place.The file size I get (vba32.fxe) is also less than the original executable
362.0 kb instead of 371.5kb
 
Back
Top