mirror of
https://github.com/dborth/snes9xgx.git
synced 2025-02-02 21:22:43 +01:00
This commit is contained in:
parent
57406336d5
commit
ac2658e001
@ -86,10 +86,10 @@ GCMixSamples ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* InitGCAudio
|
* InitAudio
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
void
|
void
|
||||||
InitGCAudio ()
|
InitAudio ()
|
||||||
{
|
{
|
||||||
LWP_CreateThread (&athread, AudioThread, NULL, astack, AUDIOSTACK, 150);
|
LWP_CreateThread (&athread, AudioThread, NULL, astack, AUDIOSTACK, 150);
|
||||||
}
|
}
|
||||||
@ -117,6 +117,16 @@ SwitchAudioMode(int mode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ShutdownAudio()
|
||||||
|
{
|
||||||
|
#ifndef NO_SOUND
|
||||||
|
ASND_Pause(1);
|
||||||
|
ASND_End();
|
||||||
|
#endif
|
||||||
|
AUDIO_StopDMA();
|
||||||
|
AUDIO_RegisterDMACallback(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* AudioStart
|
* AudioStart
|
||||||
*
|
*
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
* Audio is fixed to 32Khz/16bit/Stereo
|
* Audio is fixed to 32Khz/16bit/Stereo
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
void InitGCAudio ();
|
void InitAudio ();
|
||||||
void AudioStart ();
|
void AudioStart ();
|
||||||
void SwitchAudioMode(int mode);
|
void SwitchAudioMode(int mode);
|
||||||
|
void ShutdownAudio();
|
||||||
|
@ -361,8 +361,8 @@ ParseDirectory()
|
|||||||
void
|
void
|
||||||
AllocSaveBuffer ()
|
AllocSaveBuffer ()
|
||||||
{
|
{
|
||||||
if (savebuffer != NULL)
|
while(savebuffer != NULL) // save buffer is in use
|
||||||
free(savebuffer);
|
usleep(50); // wait for it to be free
|
||||||
|
|
||||||
savebuffer = (unsigned char *) memalign(32, SAVEBUFFERSIZE);
|
savebuffer = (unsigned char *) memalign(32, SAVEBUFFERSIZE);
|
||||||
memset (savebuffer, 0, SAVEBUFFERSIZE);
|
memset (savebuffer, 0, SAVEBUFFERSIZE);
|
||||||
|
@ -126,6 +126,7 @@ NGCFreezeGame (char * filepath, int method, bool silent)
|
|||||||
{
|
{
|
||||||
int offset = 0; // bytes written (actual)
|
int offset = 0; // bytes written (actual)
|
||||||
int woffset = 0; // bytes written (expected)
|
int woffset = 0; // bytes written (expected)
|
||||||
|
int imgSize = 0; // image screenshot bytes written
|
||||||
char msg[100];
|
char msg[100];
|
||||||
|
|
||||||
if(method == METHOD_AUTO)
|
if(method == METHOD_AUTO)
|
||||||
@ -196,17 +197,16 @@ done:
|
|||||||
|
|
||||||
if (pngContext != NULL)
|
if (pngContext != NULL)
|
||||||
{
|
{
|
||||||
PNGU_EncodeFromGXTexture(pngContext, 640, 480, gameScreenTex, 0);
|
imgSize = PNGU_EncodeFromGXTexture(pngContext, 640, 480, gameScreenTex, 0);
|
||||||
PNGU_ReleaseImageContext(pngContext);
|
PNGU_ReleaseImageContext(pngContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
int size = FindBufferSize((char *)savebuffer, 128*1024);
|
if(imgSize > 0)
|
||||||
if(size > 0)
|
|
||||||
{
|
{
|
||||||
char screenpath[1024];
|
char screenpath[1024];
|
||||||
filepath[strlen(filepath)-4] = 0;
|
filepath[strlen(filepath)-4] = 0;
|
||||||
sprintf(screenpath, "%s.png", filepath);
|
sprintf(screenpath, "%s.png", filepath);
|
||||||
SaveFile(screenpath, size, method, silent);
|
SaveFile(screenpath, imgSize, method, silent);
|
||||||
}
|
}
|
||||||
|
|
||||||
FreeSaveBuffer ();
|
FreeSaveBuffer ();
|
||||||
|
@ -57,7 +57,8 @@ GuiImage::GuiImage(int w, int h, GXColor c)
|
|||||||
this->SetPixel(x, y, c);
|
this->SetPixel(x, y, c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DCFlushRange(image, w * h * 4);
|
int len = w*h*4;
|
||||||
|
DCFlushRange(image, len+len%32);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -32,8 +32,9 @@ GuiImageData::GuiImageData(const u8 * img)
|
|||||||
height = imgProp.imgHeight;
|
height = imgProp.imgHeight;
|
||||||
data = (u8 *)memalign (32, imgProp.imgWidth * imgProp.imgHeight * 4);
|
data = (u8 *)memalign (32, imgProp.imgWidth * imgProp.imgHeight * 4);
|
||||||
PNGU_DecodeTo4x4RGBA8 (ctx, imgProp.imgWidth, imgProp.imgHeight, data, 255);
|
PNGU_DecodeTo4x4RGBA8 (ctx, imgProp.imgWidth, imgProp.imgHeight, data, 255);
|
||||||
|
int len = imgProp.imgWidth * imgProp.imgHeight * 4;
|
||||||
|
DCFlushRange(data, len+len%32);
|
||||||
PNGU_ReleaseImageContext (ctx);
|
PNGU_ReleaseImageContext (ctx);
|
||||||
DCFlushRange (data, imgProp.imgWidth * imgProp.imgHeight * 4);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -295,11 +295,6 @@ void GuiSaveBrowser::Update(GuiTrigger * t)
|
|||||||
{
|
{
|
||||||
// move list up by 1
|
// move list up by 1
|
||||||
listOffset -= 2;
|
listOffset -= 2;
|
||||||
|
|
||||||
if(selectedItem == 0)
|
|
||||||
selectedItem = SAVELISTSIZE-2;
|
|
||||||
else
|
|
||||||
selectedItem = SAVELISTSIZE-1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1220,85 +1220,6 @@ static int MenuGameSaves(int action)
|
|||||||
if(!ChangeInterface(method, NOTSILENT))
|
if(!ChangeInterface(method, NOTSILENT))
|
||||||
return MENU_GAME;
|
return MENU_GAME;
|
||||||
|
|
||||||
memset(&saves, 0, sizeof(saves));
|
|
||||||
|
|
||||||
if(method == METHOD_MC_SLOTA)
|
|
||||||
{
|
|
||||||
ParseMCDirectory(CARD_SLOTA);
|
|
||||||
}
|
|
||||||
else if(method == METHOD_MC_SLOTB)
|
|
||||||
{
|
|
||||||
ParseMCDirectory(CARD_SLOTB);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
strncpy(browser.dir, GCSettings.SaveFolder, 200);
|
|
||||||
ParseDirectory();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(browser.numEntries <= 0)
|
|
||||||
return MENU_GAME;
|
|
||||||
|
|
||||||
for(i=0; i < browser.numEntries; i++)
|
|
||||||
{
|
|
||||||
len = strlen(Memory.ROMFilename);
|
|
||||||
len2 = strlen(browserList[i].filename);
|
|
||||||
|
|
||||||
// find matching files
|
|
||||||
if(len2 > 5 && strncmp(browserList[i].filename, Memory.ROMFilename, len) == 0)
|
|
||||||
{
|
|
||||||
if(strncmp(&browserList[i].filename[len2-4], ".srm", 4) == 0)
|
|
||||||
saves.type[j] = FILE_SRAM;
|
|
||||||
else if(strncmp(&browserList[i].filename[len2-4], ".frz", 4) == 0)
|
|
||||||
saves.type[j] = FILE_SNAPSHOT;
|
|
||||||
else
|
|
||||||
saves.type[j] = -1;
|
|
||||||
|
|
||||||
if(saves.type[j] != -1)
|
|
||||||
{
|
|
||||||
int n = -1;
|
|
||||||
char tmp[300];
|
|
||||||
strncpy(tmp, browserList[i].filename, 255);
|
|
||||||
tmp[len2-4] = 0;
|
|
||||||
|
|
||||||
if(len2 - len == 7)
|
|
||||||
n = atoi(&tmp[len2-5]);
|
|
||||||
else if(len2 - len == 6)
|
|
||||||
n = atoi(&tmp[len2-6]);
|
|
||||||
|
|
||||||
if(n > 0 && n < 100)
|
|
||||||
saves.files[saves.type[j]][n] = 1;
|
|
||||||
|
|
||||||
strncpy(saves.filename[j], browserList[i].filename, 255);
|
|
||||||
|
|
||||||
if(method != METHOD_MC_SLOTA && method != METHOD_MC_SLOTB)
|
|
||||||
{
|
|
||||||
if(saves.type[j] == FILE_SNAPSHOT)
|
|
||||||
{
|
|
||||||
char scrfile[1024];
|
|
||||||
sprintf(scrfile, "%s/%s.png", GCSettings.SaveFolder, tmp);
|
|
||||||
|
|
||||||
AllocSaveBuffer();
|
|
||||||
if(LoadFile(scrfile, GCSettings.SaveMethod, SILENT))
|
|
||||||
saves.previewImg[j] = new GuiImageData(savebuffer);
|
|
||||||
FreeSaveBuffer();
|
|
||||||
}
|
|
||||||
strftime(saves.date[j], 20, "%a %b %d", &browserList[j].mtime);
|
|
||||||
strftime(saves.time[j], 10, "%I:%M %p", &browserList[j].mtime);
|
|
||||||
}
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
saves.length = j;
|
|
||||||
|
|
||||||
if(saves.length == 0 && action == 0)
|
|
||||||
{
|
|
||||||
InfoPrompt("No game saves found.");
|
|
||||||
return MENU_GAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
GuiText titleTxt(NULL, 22, (GXColor){255, 255, 255, 255});
|
GuiText titleTxt(NULL, 22, (GXColor){255, 255, 255, 255});
|
||||||
titleTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
titleTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
||||||
titleTxt.SetPosition(50,50);
|
titleTxt.SetPosition(50,50);
|
||||||
@ -1350,17 +1271,98 @@ static int MenuGameSaves(int action)
|
|||||||
closeBtn.SetTrigger(&trigHome);
|
closeBtn.SetTrigger(&trigHome);
|
||||||
closeBtn.SetEffectGrow();
|
closeBtn.SetEffectGrow();
|
||||||
|
|
||||||
|
guiReady = false;
|
||||||
|
GuiWindow w(screenwidth, screenheight);
|
||||||
|
w.Append(&backBtn);
|
||||||
|
w.Append(&closeBtn);
|
||||||
|
mainWindow->Append(&w);
|
||||||
|
mainWindow->Append(&titleTxt);
|
||||||
|
guiReady = true;
|
||||||
|
|
||||||
|
memset(&saves, 0, sizeof(saves));
|
||||||
|
|
||||||
|
if(method == METHOD_MC_SLOTA)
|
||||||
|
{
|
||||||
|
ParseMCDirectory(CARD_SLOTA);
|
||||||
|
}
|
||||||
|
else if(method == METHOD_MC_SLOTB)
|
||||||
|
{
|
||||||
|
ParseMCDirectory(CARD_SLOTB);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strncpy(browser.dir, GCSettings.SaveFolder, 200);
|
||||||
|
ParseDirectory();
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i=0; i < browser.numEntries; i++)
|
||||||
|
{
|
||||||
|
len = strlen(Memory.ROMFilename);
|
||||||
|
len2 = strlen(browserList[i].filename);
|
||||||
|
|
||||||
|
// find matching files
|
||||||
|
if(len2 > 5 && strncmp(browserList[i].filename, Memory.ROMFilename, len) == 0)
|
||||||
|
{
|
||||||
|
if(strncmp(&browserList[i].filename[len2-4], ".srm", 4) == 0)
|
||||||
|
saves.type[j] = FILE_SRAM;
|
||||||
|
else if(strncmp(&browserList[i].filename[len2-4], ".frz", 4) == 0)
|
||||||
|
saves.type[j] = FILE_SNAPSHOT;
|
||||||
|
else
|
||||||
|
saves.type[j] = -1;
|
||||||
|
|
||||||
|
if(saves.type[j] != -1)
|
||||||
|
{
|
||||||
|
int n = -1;
|
||||||
|
char tmp[300];
|
||||||
|
strncpy(tmp, browserList[i].filename, 255);
|
||||||
|
tmp[len2-4] = 0;
|
||||||
|
|
||||||
|
if(len2 - len == 7)
|
||||||
|
n = atoi(&tmp[len2-5]);
|
||||||
|
else if(len2 - len == 6)
|
||||||
|
n = atoi(&tmp[len2-6]);
|
||||||
|
|
||||||
|
if(n > 0 && n < 100)
|
||||||
|
saves.files[saves.type[j]][n] = 1;
|
||||||
|
|
||||||
|
strncpy(saves.filename[j], browserList[i].filename, 255);
|
||||||
|
|
||||||
|
if(method != METHOD_MC_SLOTA && method != METHOD_MC_SLOTB)
|
||||||
|
{
|
||||||
|
if(saves.type[j] == FILE_SNAPSHOT)
|
||||||
|
{
|
||||||
|
char scrfile[1024];
|
||||||
|
sprintf(scrfile, "%s/%s.png", GCSettings.SaveFolder, tmp);
|
||||||
|
|
||||||
|
AllocSaveBuffer();
|
||||||
|
if(LoadFile(scrfile, GCSettings.SaveMethod, SILENT))
|
||||||
|
{
|
||||||
|
saves.previewImg[j] = new GuiImageData(savebuffer);
|
||||||
|
}
|
||||||
|
FreeSaveBuffer();
|
||||||
|
}
|
||||||
|
strftime(saves.date[j], 20, "%a %b %d", &browserList[j].mtime);
|
||||||
|
strftime(saves.time[j], 10, "%I:%M %p", &browserList[j].mtime);
|
||||||
|
}
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
saves.length = j;
|
||||||
|
|
||||||
|
if(saves.length == 0 && action == 0)
|
||||||
|
{
|
||||||
|
InfoPrompt("No game saves found.");
|
||||||
|
menu = MENU_GAME;
|
||||||
|
}
|
||||||
|
|
||||||
GuiSaveBrowser saveBrowser(552, 248, &saves, action);
|
GuiSaveBrowser saveBrowser(552, 248, &saves, action);
|
||||||
saveBrowser.SetPosition(0, 108);
|
saveBrowser.SetPosition(0, 108);
|
||||||
saveBrowser.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
saveBrowser.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||||
|
|
||||||
guiReady = false;
|
guiReady = false;
|
||||||
GuiWindow w(screenwidth, screenheight);
|
|
||||||
w.Append(&backBtn);
|
|
||||||
w.Append(&closeBtn);
|
|
||||||
mainWindow->Append(&saveBrowser);
|
mainWindow->Append(&saveBrowser);
|
||||||
mainWindow->Append(&w);
|
|
||||||
mainWindow->Append(&titleTxt);
|
|
||||||
guiReady = true;
|
guiReady = true;
|
||||||
|
|
||||||
while(menu == MENU_NONE)
|
while(menu == MENU_NONE)
|
||||||
@ -3091,7 +3093,7 @@ MainMenu (int menu)
|
|||||||
memTxt = new GuiText(NULL, 22, (GXColor){255, 255, 255, 255});
|
memTxt = new GuiText(NULL, 22, (GXColor){255, 255, 255, 255});
|
||||||
memTxt->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
|
memTxt->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
|
||||||
memTxt->SetPosition(-20, 40);
|
memTxt->SetPosition(-20, 40);
|
||||||
//mainWindow->Append(memTxt);
|
mainWindow->Append(memTxt);
|
||||||
|
|
||||||
guiReady = true;
|
guiReady = true;
|
||||||
ResumeGui();
|
ResumeGui();
|
||||||
|
@ -202,7 +202,7 @@ void InitializeNetwork(bool silent)
|
|||||||
void CloseShare()
|
void CloseShare()
|
||||||
{
|
{
|
||||||
if(networkShareInit)
|
if(networkShareInit)
|
||||||
smbClose();
|
smbClose("smb");
|
||||||
networkShareInit = false;
|
networkShareInit = false;
|
||||||
networkInit = false; // trigger a network reinit
|
networkInit = false; // trigger a network reinit
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ S9xOpenSoundDevice (int mode, bool8 stereo, int buffer_size)
|
|||||||
so.sound_switch = 255;
|
so.sound_switch = 255;
|
||||||
S9xSetPlaybackRate (so.playback_rate);
|
S9xSetPlaybackRate (so.playback_rate);
|
||||||
|
|
||||||
InitGCAudio ();
|
InitAudio ();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* softdev July 2006
|
* softdev July 2006
|
||||||
* crunchy2 May 2007-July 2007
|
* crunchy2 May 2007-July 2007
|
||||||
* Michniewski 2008
|
* Michniewski 2008
|
||||||
* Tantric September 2008
|
* Tantric 2008-2009
|
||||||
*
|
*
|
||||||
* snes9xGX.cpp
|
* snes9xGX.cpp
|
||||||
*
|
*
|
||||||
@ -78,15 +78,16 @@ extern unsigned int timediffallowed;
|
|||||||
|
|
||||||
void ExitCleanup()
|
void ExitCleanup()
|
||||||
{
|
{
|
||||||
|
#ifdef HW_RVL
|
||||||
|
ShutoffRumble();
|
||||||
|
#endif
|
||||||
|
ShutdownAudio();
|
||||||
StopGX();
|
StopGX();
|
||||||
|
|
||||||
LWP_SuspendThread (devicethread);
|
LWP_SuspendThread (devicethread);
|
||||||
UnmountAllFAT();
|
UnmountAllFAT();
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
ShutoffRumble();
|
|
||||||
WPAD_Shutdown();
|
|
||||||
CloseShare();
|
|
||||||
DI_Close();
|
DI_Close();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -431,7 +432,7 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
// Initialize font system
|
// Initialize font system
|
||||||
fontSystem = new FreeTypeGX();
|
fontSystem = new FreeTypeGX();
|
||||||
//fontSystem->setCompatibilityMode(FTGX_COMPATIBILITY_GRRLIB);
|
fontSystem->setCompatibilityMode(FTGX_COMPATIBILITY_DEFAULT_TEVOP_GX_PASSCLR | FTGX_COMPATIBILITY_DEFAULT_VTXDESC_GX_NONE);
|
||||||
|
|
||||||
InitGUIThreads();
|
InitGUIThreads();
|
||||||
|
|
||||||
|
@ -410,9 +410,6 @@ StartGX ()
|
|||||||
|
|
||||||
void StopGX()
|
void StopGX()
|
||||||
{
|
{
|
||||||
free(MEM_K1_TO_K0(xfb[0])); xfb[0] = NULL;
|
|
||||||
free(MEM_K1_TO_K0(xfb[1])); xfb[1] = NULL;
|
|
||||||
|
|
||||||
GX_AbortFrame();
|
GX_AbortFrame();
|
||||||
GX_Flush();
|
GX_Flush();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user