fix bugs in slot-1 init that made non-default choices fail to init at emulator boot-up time

This commit is contained in:
zeromus 2012-10-24 18:14:48 +00:00
parent e6216b978a
commit 02882f9483
4 changed files with 18 additions and 25 deletions

View File

@ -40,7 +40,7 @@ SLOT1INTERFACE slot1List[NDS_SLOT1_COUNT] = {
};
SLOT1INTERFACE slot1_device = slot1Retail; //default for frontends that dont even configure this
u8 slot1_device_type = NDS_SLOT1_RETAIL;
NDS_SLOT1_TYPE slot1_device_type = NDS_SLOT1_RETAIL;
static void scanDir()
{
@ -112,4 +112,9 @@ std::string slot1GetFatDir()
EMUFILE* slot1GetFatImage()
{
return fatImage;
}
NDS_SLOT1_TYPE slot1GetCurrentType()
{
return slot1_device_type;
}

View File

@ -67,7 +67,6 @@ enum NDS_SLOT1_TYPE
extern SLOT1INTERFACE slot1_device; // current slot1 device
extern SLOT1INTERFACE slot1List[NDS_SLOT1_COUNT];
extern u8 slot1_device_type;
BOOL slot1Init();
void slot1Close();
@ -75,5 +74,6 @@ void slot1Reset();
BOOL slot1Change(NDS_SLOT1_TYPE type); // change current adddon
void slot1SetFatDir(const std::string& dir);
std::string slot1GetFatDir();
NDS_SLOT1_TYPE slot1GetCurrentType();
EMUFILE* slot1GetFatImage();
#endif //__SLOT1_H__

View File

@ -2761,7 +2761,7 @@ int _main()
ViewLights = new TOOLSCLASS(hAppInst, IDD_LIGHT_VIEWER, (DLGPROC) ViewLightsProc);
// Slot 1 / Slot 2 (GBA slot)
slot1_device_type = (NDS_SLOT1_TYPE)GetPrivateProfileInt("Slot1", "type", NDS_SLOT1_RETAIL, IniName);
int slot1_device_type = (NDS_SLOT1_TYPE)GetPrivateProfileInt("Slot1", "type", NDS_SLOT1_RETAIL, IniName);
cmdline.slot1_fat_dir = GetPrivateProfileStdString("Slot1", "fat_path", "");
addon_type = (NDS_ADDON_TYPE)GetPrivateProfileInt("GBAslot", "type", NDS_ADDON_NONE, IniName);
@ -2773,18 +2773,6 @@ int _main()
cmdline.process_addonCommands();
WIN_InstallCFlash();
switch (slot1_device_type)
{
case NDS_SLOT1_NONE:
case NDS_SLOT1_RETAIL:
case NDS_SLOT1_R4:
case NDS_SLOT1_RETAIL_NAND:
break;
default:
slot1_device_type = NDS_SLOT1_RETAIL;
break;
}
if(cmdline.is_cflash_configured)
{
addon_type = NDS_ADDON_CFLASH;

View File

@ -24,13 +24,13 @@
#include "../NDSSystem.h"
#include <shlobj.h>
HWND wndConfigSlot1 = NULL;
u8 temp_type_slot1 = 0;
u8 last_type_slot1 = 0;
char tmp_fat_path[MAX_PATH] = {0};
HWND OKbutton_slot1 = NULL;
bool _OKbutton_slot1 = false;
bool needReset_slot1 = true;
HWND wndConfigSlot1 = NULL;
NDS_SLOT1_TYPE temp_type_slot1 = NDS_SLOT1_NONE;
u8 last_type_slot1 = 0;
char tmp_fat_path[MAX_PATH] = {0};
HWND OKbutton_slot1 = NULL;
bool _OKbutton_slot1 = false;
bool needReset_slot1 = true;
INT_PTR CALLBACK Slot1None(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
@ -162,7 +162,7 @@ BOOL CALLBACK Slot1Box_Proc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
case IDC_ADDONS_LIST:
if (HIWORD(wparam) == CBN_SELENDOK)
{
temp_type_slot1 = ComboBox_GetCurSel(GetDlgItem(dialog, IDC_ADDONS_LIST));
temp_type_slot1 = (NDS_SLOT1_TYPE)ComboBox_GetCurSel(GetDlgItem(dialog, IDC_ADDONS_LIST));
if (temp_type_slot1 != last_type_slot1)
{
if (wndConfigSlot1) DestroyWindow(wndConfigSlot1);
@ -191,7 +191,7 @@ BOOL CALLBACK Slot1Box_Proc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
void slot1Dialog(HWND hwnd)
{
strcpy(tmp_fat_path, slot1GetFatDir().c_str());
temp_type_slot1 = slot1_device_type;
temp_type_slot1 = slot1GetCurrentType();
last_type_slot1 = temp_type_slot1;
_OKbutton_slot1 = false;
needReset_slot1 = true;
@ -201,7 +201,7 @@ void slot1Dialog(HWND hwnd)
switch (temp_type_slot1)
{
case NDS_SLOT1_NONE:
if (temp_type_slot1 != slot1_device_type)
if (temp_type_slot1 != slot1GetCurrentType())
needReset_slot1 = true;
else
needReset_slot1 = false;