mirror of
https://github.com/dborth/snes9xgx.git
synced 2024-11-30 22:44:22 +01:00
corrections/improvements to game saving
This commit is contained in:
parent
f3e034f8a0
commit
5df651b562
@ -135,6 +135,31 @@ NGCFreezeGame (char * filepath, int method, bool silent)
|
|||||||
if(method == METHOD_AUTO)
|
if(method == METHOD_AUTO)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
// save screenshot - I would prefer to do this from gameScreenTex
|
||||||
|
if(gameScreenTex2 != NULL && method != METHOD_MC_SLOTA && method != METHOD_MC_SLOTB)
|
||||||
|
{
|
||||||
|
AllocSaveBuffer ();
|
||||||
|
|
||||||
|
IMGCTX pngContext = PNGU_SelectImageFromBuffer(savebuffer);
|
||||||
|
|
||||||
|
if (pngContext != NULL)
|
||||||
|
{
|
||||||
|
imgSize = PNGU_EncodeFromGXTexture(pngContext, screenwidth, screenheight, gameScreenTex2, 0);
|
||||||
|
PNGU_ReleaseImageContext(pngContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(imgSize > 0)
|
||||||
|
{
|
||||||
|
char screenpath[1024];
|
||||||
|
strncpy(screenpath, filepath, 1024);
|
||||||
|
screenpath[strlen(screenpath)-4] = 0;
|
||||||
|
sprintf(screenpath, "%s.png", screenpath);
|
||||||
|
SaveFile(screenpath, imgSize, method, silent);
|
||||||
|
}
|
||||||
|
|
||||||
|
FreeSaveBuffer ();
|
||||||
|
}
|
||||||
|
|
||||||
S9xSetSoundMute (TRUE);
|
S9xSetSoundMute (TRUE);
|
||||||
S9xPrepareSoundForSnapshotSave (FALSE);
|
S9xPrepareSoundForSnapshotSave (FALSE);
|
||||||
|
|
||||||
@ -185,30 +210,6 @@ done:
|
|||||||
|
|
||||||
FreeSaveBuffer ();
|
FreeSaveBuffer ();
|
||||||
|
|
||||||
// save screenshot - I would prefer to do this from gameScreenTex
|
|
||||||
if(gameScreenTex2 != NULL && method != METHOD_MC_SLOTA && method != METHOD_MC_SLOTB)
|
|
||||||
{
|
|
||||||
AllocSaveBuffer ();
|
|
||||||
|
|
||||||
IMGCTX pngContext = PNGU_SelectImageFromBuffer(savebuffer);
|
|
||||||
|
|
||||||
if (pngContext != NULL)
|
|
||||||
{
|
|
||||||
imgSize = PNGU_EncodeFromGXTexture(pngContext, 640, 480, gameScreenTex2, 0);
|
|
||||||
PNGU_ReleaseImageContext(pngContext);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(imgSize > 0)
|
|
||||||
{
|
|
||||||
char screenpath[1024];
|
|
||||||
filepath[strlen(filepath)-4] = 0;
|
|
||||||
sprintf(screenpath, "%s.png", filepath);
|
|
||||||
SaveFile(screenpath, imgSize, method, silent);
|
|
||||||
}
|
|
||||||
|
|
||||||
FreeSaveBuffer ();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(offset > 0) // save successful!
|
if(offset > 0) // save successful!
|
||||||
{
|
{
|
||||||
if(!silent)
|
if(!silent)
|
||||||
|
@ -22,10 +22,10 @@ GuiSaveBrowser::GuiSaveBrowser(int w, int h, SaveList * s, int a)
|
|||||||
action = a;
|
action = a;
|
||||||
selectable = true;
|
selectable = true;
|
||||||
|
|
||||||
if(action == 0) // save
|
if(action == 0) // load
|
||||||
listOffset = 0;
|
listOffset = 0;
|
||||||
else
|
else
|
||||||
listOffset = -2;
|
listOffset = -2; // save - reserve -2 & -1 for new slots
|
||||||
|
|
||||||
selectedItem = 0;
|
selectedItem = 0;
|
||||||
focus = 0; // allow focus
|
focus = 0; // allow focus
|
||||||
@ -199,13 +199,13 @@ void GuiSaveBrowser::ResetState()
|
|||||||
|
|
||||||
int GuiSaveBrowser::GetClickedSave()
|
int GuiSaveBrowser::GetClickedSave()
|
||||||
{
|
{
|
||||||
int found = -1;
|
int found = -3;
|
||||||
for(int i=0; i<SAVELISTSIZE; i++)
|
for(int i=0; i<SAVELISTSIZE; i++)
|
||||||
{
|
{
|
||||||
if(saveBtn[i]->GetState() == STATE_CLICKED)
|
if(saveBtn[i]->GetState() == STATE_CLICKED)
|
||||||
{
|
{
|
||||||
saveBtn[i]->SetState(STATE_SELECTED);
|
saveBtn[i]->SetState(STATE_SELECTED);
|
||||||
found = i;
|
found = listOffset+i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -606,7 +606,7 @@ void SetControllers()
|
|||||||
else if (Settings.SuperScopeMaster == true)
|
else if (Settings.SuperScopeMaster == true)
|
||||||
{
|
{
|
||||||
S9xSetController (0, CTL_JOYPAD, 0, 0, 0, 0);
|
S9xSetController (0, CTL_JOYPAD, 0, 0, 0, 0);
|
||||||
S9xSetController (1, CTL_SUPERSCOPE, 1, 0, 0, 0);
|
S9xSetController (1, CTL_SUPERSCOPE, 0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
else if (Settings.MouseMaster == true)
|
else if (Settings.MouseMaster == true)
|
||||||
{
|
{
|
||||||
|
@ -1626,7 +1626,7 @@ static int MenuGameSaves(int action)
|
|||||||
ret = saveBrowser.GetClickedSave();
|
ret = saveBrowser.GetClickedSave();
|
||||||
|
|
||||||
// load or save game
|
// load or save game
|
||||||
if(ret >= 0)
|
if(ret > -3)
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|
||||||
@ -1647,7 +1647,7 @@ static int MenuGameSaves(int action)
|
|||||||
}
|
}
|
||||||
else // save
|
else // save
|
||||||
{
|
{
|
||||||
if(ret == 0) // new SRAM
|
if(ret == -2) // new SRAM
|
||||||
{
|
{
|
||||||
for(i=1; i < 100; i++)
|
for(i=1; i < 100; i++)
|
||||||
if(saves.files[FILE_SRAM][i] == 0)
|
if(saves.files[FILE_SRAM][i] == 0)
|
||||||
@ -1660,7 +1660,7 @@ static int MenuGameSaves(int action)
|
|||||||
menu = MENU_GAME_SAVE;
|
menu = MENU_GAME_SAVE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(ret == 1) // new Snapshot
|
else if(ret == -1) // new Snapshot
|
||||||
{
|
{
|
||||||
for(i=1; i < 100; i++)
|
for(i=1; i < 100; i++)
|
||||||
if(saves.files[FILE_SNAPSHOT][i] == 0)
|
if(saves.files[FILE_SNAPSHOT][i] == 0)
|
||||||
@ -1675,8 +1675,8 @@ static int MenuGameSaves(int action)
|
|||||||
}
|
}
|
||||||
else // overwrite SRAM/Snapshot
|
else // overwrite SRAM/Snapshot
|
||||||
{
|
{
|
||||||
MakeFilePath(filepath, saves.type[ret-2], method, saves.filename[ret-2]);
|
MakeFilePath(filepath, saves.type[ret], method, saves.filename[ret]);
|
||||||
switch(saves.type[ret-2])
|
switch(saves.type[ret])
|
||||||
{
|
{
|
||||||
case FILE_SRAM:
|
case FILE_SRAM:
|
||||||
SaveSRAM(filepath, GCSettings.SaveMethod, NOTSILENT);
|
SaveSRAM(filepath, GCSettings.SaveMethod, NOTSILENT);
|
||||||
|
Loading…
Reference in New Issue
Block a user