port r3749 from 096 release branch
This commit is contained in:
parent
cb0ce43bfc
commit
864e2664a3
|
@ -119,6 +119,12 @@ const char *save_names[] = {
|
||||||
"FLASH 512Mbit"
|
"FLASH 512Mbit"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//forces the currently selected backup type to be current
|
||||||
|
//(can possibly be used to repair poorly chosen save types discovered late in gameplay i.e. pokemon gamers)
|
||||||
|
void backup_forceManualBackupType()
|
||||||
|
{
|
||||||
|
MMU_new.backupDevice.forceManualBackupType();
|
||||||
|
}
|
||||||
|
|
||||||
void backup_setManualBackupType(int type)
|
void backup_setManualBackupType(int type)
|
||||||
{
|
{
|
||||||
|
@ -1148,3 +1154,9 @@ bool BackupDevice::load_movie(EMUFILE* is) {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BackupDevice::forceManualBackupType()
|
||||||
|
{
|
||||||
|
addr_size = addr_size_for_old_save_size(save_types[CommonSettings.manualBackupType][1]);
|
||||||
|
state = RUNNING;
|
||||||
|
}
|
|
@ -82,6 +82,7 @@ public:
|
||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
void close_rom();
|
void close_rom();
|
||||||
|
void forceManualBackupType();
|
||||||
void reset_hardware();
|
void reset_hardware();
|
||||||
|
|
||||||
bool save_state(EMUFILE* os);
|
bool save_state(EMUFILE* os);
|
||||||
|
@ -169,6 +170,7 @@ void fw_reset_com(memory_chip_t *mc); /* reset communication with mc */
|
||||||
u8 fw_transfer(memory_chip_t *mc, u8 data);
|
u8 fw_transfer(memory_chip_t *mc, u8 data);
|
||||||
|
|
||||||
void backup_setManualBackupType(int type);
|
void backup_setManualBackupType(int type);
|
||||||
|
void backup_forceManualBackupType();
|
||||||
|
|
||||||
extern const char *save_names[];
|
extern const char *save_names[];
|
||||||
|
|
||||||
|
|
|
@ -91,6 +91,36 @@ void HK_ReloadROM(int, bool justPressed)
|
||||||
void OpenRecentROM(int listNum);
|
void OpenRecentROM(int listNum);
|
||||||
OpenRecentROM(0);
|
OpenRecentROM(0);
|
||||||
}
|
}
|
||||||
|
void HK_QuickScreenShot(int param, bool justPressed)
|
||||||
|
{
|
||||||
|
char buffer[MAX_PATH];
|
||||||
|
ZeroMemory(buffer, sizeof(buffer));
|
||||||
|
path.getpath(path.SCREENSHOTS, buffer);
|
||||||
|
|
||||||
|
char file[MAX_PATH];
|
||||||
|
ZeroMemory(file, sizeof(file));
|
||||||
|
path.formatname(file);
|
||||||
|
|
||||||
|
strcat(buffer, file);
|
||||||
|
if( strlen(buffer) > (MAX_PATH - 4))
|
||||||
|
buffer[MAX_PATH - 4] = '\0';
|
||||||
|
|
||||||
|
switch(path.imageformat())
|
||||||
|
{
|
||||||
|
case path.PNG:
|
||||||
|
{
|
||||||
|
strcat(buffer, ".png");
|
||||||
|
NDS_WritePNG(buffer);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case path.BMP:
|
||||||
|
{
|
||||||
|
strcat(buffer, ".bmp");
|
||||||
|
NDS_WriteBMP(buffer);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
void HK_PrintScreen(int param, bool justPressed)
|
void HK_PrintScreen(int param, bool justPressed)
|
||||||
{
|
{
|
||||||
char outFilename[MAX_PATH];
|
char outFilename[MAX_PATH];
|
||||||
|
@ -507,6 +537,13 @@ void InitCustomKeys (SCustomKeys *keys)
|
||||||
keys->PrintScreen.page = HOTKEY_PAGE_MAIN;
|
keys->PrintScreen.page = HOTKEY_PAGE_MAIN;
|
||||||
keys->PrintScreen.key = VK_F12;
|
keys->PrintScreen.key = VK_F12;
|
||||||
|
|
||||||
|
keys->QuickPrintScreen.handleKeyDown = HK_QuickScreenShot;
|
||||||
|
keys->QuickPrintScreen.code = "QuickScreenshot";
|
||||||
|
keys->QuickPrintScreen.name = STRW(ID_LABEL_HK13b);
|
||||||
|
keys->QuickPrintScreen.page = HOTKEY_PAGE_MAIN;
|
||||||
|
keys->QuickPrintScreen.key = VK_F12;
|
||||||
|
keys->QuickPrintScreen.modifiers = CUSTKEY_CTRL_MASK;
|
||||||
|
|
||||||
keys->ToggleReadOnly.handleKeyDown = HK_ToggleReadOnly;
|
keys->ToggleReadOnly.handleKeyDown = HK_ToggleReadOnly;
|
||||||
keys->ToggleReadOnly.code = "ToggleReadOnly";
|
keys->ToggleReadOnly.code = "ToggleReadOnly";
|
||||||
keys->ToggleReadOnly.name = STRW(ID_LABEL_HK24);
|
keys->ToggleReadOnly.name = STRW(ID_LABEL_HK24);
|
||||||
|
|
|
@ -78,6 +78,7 @@ struct SCustomKeys
|
||||||
|
|
||||||
SCustomKey ToggleRasterizer;
|
SCustomKey ToggleRasterizer;
|
||||||
SCustomKey PrintScreen; //Screenshot
|
SCustomKey PrintScreen; //Screenshot
|
||||||
|
SCustomKey QuickPrintScreen;
|
||||||
|
|
||||||
SCustomKey RecordWAV, RecordAVI;
|
SCustomKey RecordWAV, RecordAVI;
|
||||||
|
|
||||||
|
@ -112,6 +113,7 @@ int GetModifiers(int key);
|
||||||
|
|
||||||
//HOTKEY HANDLERS
|
//HOTKEY HANDLERS
|
||||||
void HK_PrintScreen(int, bool);
|
void HK_PrintScreen(int, bool);
|
||||||
|
void HK_QuickScreenShot(int, bool);
|
||||||
void HK_StateSaveSlot(int, bool);
|
void HK_StateSaveSlot(int, bool);
|
||||||
void HK_StateLoadSlot(int, bool);
|
void HK_StateLoadSlot(int, bool);
|
||||||
void HK_StateSetSlot(int, bool);
|
void HK_StateSetSlot(int, bool);
|
||||||
|
|
|
@ -105,6 +105,39 @@
|
||||||
#include "ram_search.h"
|
#include "ram_search.h"
|
||||||
#include "aviout.h"
|
#include "aviout.h"
|
||||||
#include "soundView.h"
|
#include "soundView.h"
|
||||||
|
//
|
||||||
|
//static size_t heapram = 0;
|
||||||
|
//void* operator new[](size_t amt)
|
||||||
|
//{
|
||||||
|
// if(amt>5*1024*1024)
|
||||||
|
// {
|
||||||
|
// int zzz=9;
|
||||||
|
// }
|
||||||
|
// printf("Heap alloc up to %d bytes\n",heapram);
|
||||||
|
// heapram += amt;
|
||||||
|
// u32* buf = (u32*)malloc(amt+4);
|
||||||
|
// *buf = amt;
|
||||||
|
// return buf+1;
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//void operator delete[](void* ptr)
|
||||||
|
//{
|
||||||
|
// if(!ptr) return;
|
||||||
|
// u32* buf = (u32*)ptr;
|
||||||
|
// buf--;
|
||||||
|
// heapram -= *buf;
|
||||||
|
// free(buf);
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//void* operator new(size_t amt)
|
||||||
|
//{
|
||||||
|
// return operator new[](amt);
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//void operator delete(void* ptr)
|
||||||
|
//{
|
||||||
|
// return operator delete[](ptr);
|
||||||
|
//}
|
||||||
|
|
||||||
//#include <libelf/libelf.h>
|
//#include <libelf/libelf.h>
|
||||||
//#include <libelf/gelf.h>
|
//#include <libelf/gelf.h>
|
||||||
|
@ -2092,12 +2125,17 @@ int MenuInit()
|
||||||
|
|
||||||
ResetSaveStateTimes();
|
ResetSaveStateTimes();
|
||||||
|
|
||||||
|
HMENU configMenu = GetSubMenuByIdOfFirstChild(mainMenu,IDM_3DCONFIG);
|
||||||
|
HMENU advancedMenu = GetSubMenuByIdOfFirstChild(configMenu,ID_ADVANCED);
|
||||||
|
DeleteMenu(advancedMenu,ID_ADVANCED,MF_BYCOMMAND);
|
||||||
|
|
||||||
#ifndef DEVELOPER_MENU_ITEMS
|
#ifndef DEVELOPER_MENU_ITEMS
|
||||||
// menu items that are only useful for desmume developers (maybe)
|
// menu items that are only useful for desmume developers (maybe)
|
||||||
HMENU fileMenu = GetSubMenu(mainMenu, 0);
|
HMENU fileMenu = GetSubMenu(mainMenu, 0);
|
||||||
DeleteMenu(fileMenu, IDM_FILE_RECORDUSERSPUWAV, MF_BYCOMMAND);
|
DeleteMenu(fileMenu, IDM_FILE_RECORDUSERSPUWAV, MF_BYCOMMAND);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef DEVELOPER
|
||||||
for(int i=0; i<MAX_SAVE_TYPES; i++)
|
for(int i=0; i<MAX_SAVE_TYPES; i++)
|
||||||
{
|
{
|
||||||
memset(&mm, 0, sizeof(MENUITEMINFO));
|
memset(&mm, 0, sizeof(MENUITEMINFO));
|
||||||
|
@ -2115,6 +2153,9 @@ int MenuInit()
|
||||||
mm.fMask = MIIM_TYPE;
|
mm.fMask = MIIM_TYPE;
|
||||||
mm.fType = MFT_SEPARATOR;
|
mm.fType = MFT_SEPARATOR;
|
||||||
MainWindow->addMenuItem(IDC_SAVETYPE, false, &mm);
|
MainWindow->addMenuItem(IDC_SAVETYPE, false, &mm);
|
||||||
|
#else
|
||||||
|
DeleteMenu(configMenu,GetSubMenuIndexByHMENU(configMenu,advancedMenu),MF_BYPOSITION);
|
||||||
|
#endif
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -4522,35 +4563,7 @@ DOKEYDOWN:
|
||||||
HK_PrintScreen(0, true);
|
HK_PrintScreen(0, true);
|
||||||
return 0;
|
return 0;
|
||||||
case IDM_QUICK_PRINTSCREEN:
|
case IDM_QUICK_PRINTSCREEN:
|
||||||
{
|
HK_QuickScreenShot(0, true);
|
||||||
char buffer[MAX_PATH];
|
|
||||||
ZeroMemory(buffer, sizeof(buffer));
|
|
||||||
path.getpath(path.SCREENSHOTS, buffer);
|
|
||||||
|
|
||||||
char file[MAX_PATH];
|
|
||||||
ZeroMemory(file, sizeof(file));
|
|
||||||
path.formatname(file);
|
|
||||||
|
|
||||||
strcat(buffer, file);
|
|
||||||
if( strlen(buffer) > (MAX_PATH - 4))
|
|
||||||
buffer[MAX_PATH - 4] = '\0';
|
|
||||||
|
|
||||||
switch(path.imageformat())
|
|
||||||
{
|
|
||||||
case path.PNG:
|
|
||||||
{
|
|
||||||
strcat(buffer, ".png");
|
|
||||||
NDS_WritePNG(buffer);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case path.BMP:
|
|
||||||
{
|
|
||||||
strcat(buffer, ".bmp");
|
|
||||||
NDS_WriteBMP(buffer);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
case IDM_FILE_RECORDAVI:
|
case IDM_FILE_RECORDAVI:
|
||||||
if (AVI_IsRecording())
|
if (AVI_IsRecording())
|
||||||
|
@ -5345,6 +5358,8 @@ DOKEYDOWN:
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
case IDC_SAVETYPE_FORCE: backup_forceManualBackupType(); return 0;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
u32 id = LOWORD(wParam);
|
u32 id = LOWORD(wParam);
|
||||||
|
@ -6154,6 +6169,7 @@ void UpdateHotkeyAssignments()
|
||||||
{
|
{
|
||||||
UpdateHotkeyAssignment(CustomKeys.OpenROM, IDM_OPEN);
|
UpdateHotkeyAssignment(CustomKeys.OpenROM, IDM_OPEN);
|
||||||
UpdateHotkeyAssignment(CustomKeys.PrintScreen, IDM_PRINTSCREEN);
|
UpdateHotkeyAssignment(CustomKeys.PrintScreen, IDM_PRINTSCREEN);
|
||||||
|
UpdateHotkeyAssignment(CustomKeys.QuickPrintScreen, IDM_QUICK_PRINTSCREEN);
|
||||||
UpdateHotkeyAssignment(CustomKeys.RecordAVI, IDM_FILE_RECORDAVI);
|
UpdateHotkeyAssignment(CustomKeys.RecordAVI, IDM_FILE_RECORDAVI);
|
||||||
UpdateHotkeyAssignment(CustomKeys.Pause, IDM_PAUSE);
|
UpdateHotkeyAssignment(CustomKeys.Pause, IDM_PAUSE);
|
||||||
UpdateHotkeyAssignment(CustomKeys.Reset, IDM_RESET);
|
UpdateHotkeyAssignment(CustomKeys.Reset, IDM_RESET);
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -115,3 +115,38 @@ void CheckDlgItem(HWND hDlg, int id, bool checked)
|
||||||
CheckDlgButton(hDlg, id, checked ? BST_CHECKED : BST_UNCHECKED);
|
CheckDlgButton(hDlg, id, checked ? BST_CHECKED : BST_UNCHECKED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HMENU GetSubMenuByIdOfFirstChild(HMENU menu, UINT child)
|
||||||
|
{
|
||||||
|
int count = GetMenuItemCount(menu);
|
||||||
|
for(int i=0;i<count;i++)
|
||||||
|
{
|
||||||
|
HMENU sub = GetSubMenu(menu,i);
|
||||||
|
MENUITEMINFO moo;
|
||||||
|
moo.cbSize = sizeof(moo);
|
||||||
|
moo.fMask = MIIM_ID;
|
||||||
|
GetMenuItemInfo(sub,0,TRUE,&moo);
|
||||||
|
if(moo.wID == child)
|
||||||
|
return sub;
|
||||||
|
}
|
||||||
|
return (HMENU)0;
|
||||||
|
}
|
||||||
|
|
||||||
|
HMENU GetSubMenuById(HMENU menu, UINT id)
|
||||||
|
{
|
||||||
|
MENUITEMINFO moo;
|
||||||
|
moo.cbSize = sizeof(moo);
|
||||||
|
moo.fMask = MIIM_SUBMENU;
|
||||||
|
GetMenuItemInfo(menu,id,FALSE,&moo);
|
||||||
|
return moo.hSubMenu;
|
||||||
|
}
|
||||||
|
|
||||||
|
int GetSubMenuIndexByHMENU(HMENU menu, HMENU sub)
|
||||||
|
{
|
||||||
|
int count = GetMenuItemCount(menu);
|
||||||
|
for(int i=0;i<count;i++)
|
||||||
|
{
|
||||||
|
HMENU trial = GetSubMenu(menu,i);
|
||||||
|
if(sub == trial) return i;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
|
@ -35,6 +35,10 @@ void DesEnableMenuItem(HMENU hMenu, UINT uIDEnableItem, bool enable);
|
||||||
std::string GetPrivateProfileStdString(LPCSTR lpAppName,LPCSTR lpKeyName,LPCSTR lpDefault);
|
std::string GetPrivateProfileStdString(LPCSTR lpAppName,LPCSTR lpKeyName,LPCSTR lpDefault);
|
||||||
void CheckDlgItem(HWND hDlg, int id, bool checked);
|
void CheckDlgItem(HWND hDlg, int id, bool checked);
|
||||||
bool IsDlgCheckboxChecked(HWND hDlg, int id);
|
bool IsDlgCheckboxChecked(HWND hDlg, int id);
|
||||||
|
HMENU GetSubMenuByIdOfFirstChild(HMENU menu, UINT child);
|
||||||
|
HMENU GetSubMenuById(HMENU menu, UINT id); //untested
|
||||||
|
int GetSubMenuIndexByHMENU(HMENU menu, HMENU sub);
|
||||||
|
|
||||||
|
|
||||||
//returns the specified resource string ID as a std::wstring
|
//returns the specified resource string ID as a std::wstring
|
||||||
std::wstring STRW(UINT id);
|
std::wstring STRW(UINT id);
|
||||||
|
|
Loading…
Reference in New Issue