#include <stdlib.h>
#include "main.h"
+#include "minimal.h"
#include "throttle.h"
#include "menu.h"
#include "gp2x.h"
AC(eoptions),
ACA(srendlinev),
ACA(erendlinev),
- ACA(lastLoadedGameName),
ADDCFGSTRUCT(DriverConfig),
ENDCFGSTRUCT
};
if(ntschue>=0) DriverInterface(DES_SETNTSCHUE,&ntschue);
}
+static void LoadLLGN(void)
+{
+ char tdir[2048];
+ FILE *f;
+ int len;
+ sprintf(tdir,"%s"PSS"last_rom.txt",BaseDirectory);
+ f=fopen(tdir, "r");
+ if(f)
+ {
+ len = fread(lastLoadedGameName, 1, sizeof(lastLoadedGameName)-1, f);
+ lastLoadedGameName[len] = 0;
+ fclose(f);
+ }
+}
+
+static void SaveLLGN(void)
+{
+ // save last loaded game name
+ if (lastLoadedGameName[0])
+ {
+ char tdir[2048];
+ FILE *f;
+ sprintf(tdir,"%s"PSS"last_rom.txt",BaseDirectory);
+ f=fopen(tdir, "w");
+ if(f)
+ {
+ fwrite(lastLoadedGameName, 1, strlen(lastLoadedGameName), f);
+ fclose(f);
+ sync();
+ }
+ }
+}
+
+
static void CreateDirs(void)
{
char *subs[]={"fcs","snaps","gameinfo","sav","cheats","cfg"};
}
}
if(docheckie[0])
- FCEUI_SetVidSystem(1);
+ Settings.region_force=2;
if(docheckie[1])
FCEUI_SetGameGenie(1);
FCEUI_DisableSpriteLimitation(1);
FCEUI_SetRenderedLines(srendlinev[0],erendlinev[0],srendlinev[1],erendlinev[1]);
FCEUI_SetRenderedLines(0,erendlinev[0],srendlinev[1],erendlinev[1]);
FCEUI_SetSoundVolume(soundvol);
- DriverInterface(DES_NTSCCOL,&ntsccol);
+ DriverInterface(DES_NTSCCOL,&ntsccol); // TODO
DoDriverArgs();
if(fcexp)
LoadConfig(NULL);
last_arg_parsed=DoArgs(argc-1,&argv[1]);
gp2x_opt_setup();
- gp2x_cpuclock_update();
+ gp2x_cpuclock_gamma_update();
+ LoadLLGN();
if(cpalette)
LoadCPalette();
if(InitSound())
if (fceugi)
{
LoadConfig(lastLoadedGameName);
+ if (Settings.region_force)
+ FCEUI_SetVidSystem(Settings.region_force - 1);
ParseGI(fceugi);
//RefreshThrottleFPS();
InitOtherInput();
}
}
else
- strcpy(menuErrorMsg, "failed to load ROM");
+ {
+ switch(LoadGameLastError) {
+ default: strcpy(menuErrorMsg, "failed to load ROM"); break;
+ case 2: strcpy(menuErrorMsg, "Can't find a ROM for movie"); break;
+ case 10: strcpy(menuErrorMsg, "FDS BIOS ROM is missing, read docs"); break;
+ case 11: strcpy(menuErrorMsg, "Error reading auxillary FDS file"); break;
+ }
+ }
}
if(Exit || !fceugi)
{
}
}
+ PrepareOtherInput();
gp2x_video_changemode(Settings.scaling == 3 ? 15 : 8);
- gp2x_video_RGB_setscaling(0, 320, 240);
- gp2x_start_sound(22050, 16, 0);
+ switch (Settings.scaling & 3) {
+ case 0: gp2x_video_RGB_setscaling(0, 320, 240); gp2x_video_set_offs(0); break;
+ case 1: gp2x_video_RGB_setscaling(0, 256, 240); gp2x_video_set_offs(32); break;
+ case 2: gp2x_video_RGB_setscaling(0, 256, 240); gp2x_video_set_offs(32); break; // TODO
+ case 3: gp2x_video_RGB_setscaling(0, 320, 240); gp2x_video_set_offs(32); break;
+ }
+ gp2x_start_sound(Settings.sound_rate, 16, 0);
FCEUI_Emulate();
}
if (fceugi)
CloseGame();
+ SaveLLGN();
DriverKill();
return 0;
}
inited|=2;
if(!InitVideo()) return 0;
inited|=4;
- if(!InitKeyboard()) return 0;
- inited|=8;
return 1;
}
static void DriverKill(void)
{
- SaveConfig(NULL);
+ // SaveConfig(NULL); // done explicitly in menu now
SetSignals(SIG_IGN);
if(inited&2)
KillJoysticks();
- if(inited&8)
- KillKeyboard();
if(inited&4)
KillVideo();
if(inited&1)
KillSound();
- if(inited&16)
- KillMouse();
inited=0;
}
void FCEUD_Update(uint8 *xbuf, int16 *Buffer, int Count)
{
- if(!Count && !NoWaiting && !(eoptions&EO_NOTHROTTLE))
+ if(!Count && !(eoptions&EO_NOTHROTTLE))
SpeedThrottle();
BlitScreen(xbuf);
- if(Count && !NoWaiting && !(eoptions&EO_NOTHROTTLE))
+ if(Count && !(eoptions&EO_NOTHROTTLE))
WriteSound(Buffer,Count);
FCEUD_UpdateInput();
}