- some fixes in gbaslot;
This commit is contained in:
parent
7500bd0611
commit
9445a175fc
|
@ -273,7 +273,7 @@ static void list_files(const char *filepath)
|
|||
{
|
||||
fname = (strlen(entry.cAlternateFileName)>0) ? entry.cAlternateFileName : entry.cFileName;
|
||||
add_file(fname, &entry, fileLevel);
|
||||
printf("cflash added %s\n",fname);
|
||||
CFLASHLOG("cflash added %s\n",fname);
|
||||
|
||||
if (numFiles==MAXFILES-1) break;
|
||||
|
||||
|
@ -506,17 +506,17 @@ static BOOL cflash_init()
|
|||
if (inited) return FALSE;
|
||||
BOOL init_good = FALSE;
|
||||
|
||||
printf("CFlash_Mode: %d\n",CFlash_Mode);
|
||||
CFLASHLOG("CFlash_Mode: %d\n",CFlash_Mode);
|
||||
|
||||
if (CFlash_Mode == ADDON_CFLASH_MODE_RomPath)
|
||||
{
|
||||
sFlashPath = pathToROM;
|
||||
printf("Using CFlash directory of rom: %s\n", sFlashPath.c_str());
|
||||
INFO("Using CFlash directory of rom: %s\n", sFlashPath.c_str());
|
||||
}
|
||||
else if(CFlash_Mode == ADDON_CFLASH_MODE_Path)
|
||||
{
|
||||
sFlashPath = CFlash_Path;
|
||||
printf("Using CFlash directory: %s\n", sFlashPath.c_str());
|
||||
INFO("Using CFlash directory: %s\n", sFlashPath.c_str());
|
||||
}
|
||||
|
||||
if(CFlash_IsUsingPath())
|
||||
|
@ -529,7 +529,7 @@ static BOOL cflash_init()
|
|||
activeDirEnt = -1;
|
||||
fileStartLBA = fileEndLBA = 0xFFFFFFFF;
|
||||
if (!cflash_build_fat()) {
|
||||
printf("FAILED cflash_build_fat\n");
|
||||
CFLASHLOG("FAILED cflash_build_fat\n");
|
||||
return FALSE;
|
||||
}
|
||||
cf_reg_sts = 0x58; // READY
|
||||
|
@ -540,7 +540,7 @@ static BOOL cflash_init()
|
|||
else
|
||||
{
|
||||
sFlashPath = CFlash_Path;
|
||||
printf("Using CFlash disk image file %s\n", sFlashPath.c_str());
|
||||
INFO("Using CFlash disk image file %s\n", sFlashPath.c_str());
|
||||
disk_image = OPEN_FN( sFlashPath.c_str(), OPEN_MODE);
|
||||
|
||||
if ( disk_image != -1)
|
||||
|
@ -659,7 +659,7 @@ static u16 fread_buffered(int dirent,u32 cluster,u32 offset)
|
|||
fatstring_to_asciiz(dirent,fname,NULL);
|
||||
strncat(fpath,fname,ARRAY_SIZE(fpath)-strlen(fpath));
|
||||
|
||||
printf("CFLASH Opening %s\n",fpath);
|
||||
CFLASHLOG("CFLASH Opening %s\n",fpath);
|
||||
hFile = fopen(fpath, "rb");
|
||||
if (!hFile) return 0;
|
||||
bufferStart = offset;
|
||||
|
@ -954,8 +954,6 @@ static void cflash_close( void)
|
|||
|
||||
static BOOL CFlash_init(void)
|
||||
{
|
||||
printf("CFlash_init\n");
|
||||
cflash_init();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ LRESULT Ioreg_OnPaint(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|||
sprintf(text, "0x%08X", (int)MMU.reg_IF[ARMCPU_ARM9]);
|
||||
SetWindowText(GetDlgItem(hwnd, IDC_IF9), text);
|
||||
|
||||
sprintf(text, "0x%08X", (int)MMU.reg_IME[ARMCPU_ARM9]);
|
||||
sprintf(text, "%s", ((int)(MMU.reg_IME[ARMCPU_ARM9]) & 0x01)?"enabled":"disabled");
|
||||
SetWindowText(GetDlgItem(hwnd, IDC_IME9), text);
|
||||
|
||||
sprintf(text, "0x%08X", ((u16 *)ARM9Mem.ARM9_REG)[0x0000>>1]);
|
||||
|
@ -83,7 +83,7 @@ LRESULT Ioreg_OnPaint(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|||
sprintf(text, "0x%08X", (int)MMU.reg_IF[ARMCPU_ARM7]);
|
||||
SetWindowText(GetDlgItem(hwnd, IDC_IF7), text);
|
||||
|
||||
sprintf(text, "0x%08X", (int)MMU.reg_IME[ARMCPU_ARM7]);
|
||||
sprintf(text, "%s", ((int)(MMU.reg_IME[ARMCPU_ARM7]) & 0x01)?"enabled":"disabled");
|
||||
SetWindowText(GetDlgItem(hwnd, IDC_IME7), text);
|
||||
|
||||
sprintf(text, "0x%08X", (int)((u32 *)MMU.ARM7_REG)[0x180>>2]);
|
||||
|
|
|
@ -30,14 +30,13 @@
|
|||
#include <shlobj.h>
|
||||
|
||||
WNDCLASSEX wc;
|
||||
HWND wndConfig;
|
||||
HWND wndConfig = NULL;
|
||||
u8 temp_type = 0;
|
||||
u8 last_type;
|
||||
char tmp_cflash_filename[MAX_PATH];
|
||||
char tmp_cflash_path[MAX_PATH];
|
||||
char tmp_gbagame_filename[MAX_PATH];
|
||||
u8 tmp_CFlashUsePath;
|
||||
u8 tmp_CFlashUseRomPath;
|
||||
u8 last_type = 0;
|
||||
char tmp_cflash_filename[MAX_PATH] = { 0 };
|
||||
char tmp_cflash_path[MAX_PATH] = { 0 };
|
||||
char tmp_gbagame_filename[MAX_PATH] = { 0 };
|
||||
ADDON_CFLASH_MODE tmp_CFlashMode = ADDON_CFLASH_MODE_RomPath;
|
||||
HWND OKbutton = NULL;
|
||||
bool _OKbutton = false;
|
||||
|
||||
|
@ -64,32 +63,37 @@ BOOL CALLBACK GbaSlotCFlash(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
|
|||
{
|
||||
SetWindowText(GetDlgItem(dialog, IDC_PATHIMG), tmp_cflash_filename);
|
||||
SetWindowText(GetDlgItem(dialog, IDC_PATH), tmp_cflash_path);
|
||||
if (tmp_CFlashUsePath)
|
||||
switch (tmp_CFlashMode)
|
||||
{
|
||||
if (tmp_CFlashUseRomPath)
|
||||
{
|
||||
case ADDON_CFLASH_MODE_Path:
|
||||
CheckDlgButton(dialog, IDC_RFOLDER, BST_CHECKED);
|
||||
EnableWindow(GetDlgItem(dialog, IDC_PATH), TRUE);
|
||||
EnableWindow(GetDlgItem(dialog, IDC_BBROWSE2), TRUE);
|
||||
EnableWindow(GetDlgItem(dialog, IDC_PATHIMG), FALSE);
|
||||
EnableWindow(GetDlgItem(dialog, IDC_BBROWSE), FALSE);
|
||||
if (strlen(tmp_cflash_path)) _OKbutton = TRUE;
|
||||
break;
|
||||
|
||||
case ADDON_CFLASH_MODE_File:
|
||||
CheckDlgButton(dialog, IDC_RFILE, BST_CHECKED);
|
||||
EnableWindow(GetDlgItem(dialog, IDC_PATHIMG), TRUE);
|
||||
EnableWindow(GetDlgItem(dialog, IDC_BBROWSE), TRUE);
|
||||
EnableWindow(GetDlgItem(dialog, IDC_BBROWSE2), FALSE);
|
||||
EnableWindow(GetDlgItem(dialog, IDC_PATH), FALSE);
|
||||
if (strlen(tmp_cflash_filename)) _OKbutton = TRUE;
|
||||
break;
|
||||
|
||||
case ADDON_CFLASH_MODE_RomPath:
|
||||
CheckDlgButton(dialog, IDC_PATHDESMUME, BST_CHECKED);
|
||||
EnableWindow(GetDlgItem(dialog, IDC_PATH), FALSE);
|
||||
EnableWindow(GetDlgItem(dialog, IDC_BBROWSE2), FALSE);
|
||||
EnableWindow(GetDlgItem(dialog, IDC_PATHIMG), FALSE);
|
||||
EnableWindow(GetDlgItem(dialog, IDC_BBROWSE), FALSE);
|
||||
_OKbutton = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
EnableWindow(GetDlgItem(dialog, IDC_PATH), TRUE);
|
||||
EnableWindow(GetDlgItem(dialog, IDC_BBROWSE2), TRUE);
|
||||
if (strlen(tmp_cflash_path)) _OKbutton = TRUE;
|
||||
}
|
||||
EnableWindow(GetDlgItem(dialog, IDC_PATHIMG), FALSE);
|
||||
EnableWindow(GetDlgItem(dialog, IDC_BBROWSE), FALSE);
|
||||
CheckDlgButton(dialog, IDC_RFOLDER, BST_CHECKED);
|
||||
}
|
||||
else
|
||||
{
|
||||
EnableWindow(GetDlgItem(dialog, IDC_BBROWSE2), FALSE);
|
||||
EnableWindow(GetDlgItem(dialog, IDC_PATHDESMUME), FALSE);
|
||||
EnableWindow(GetDlgItem(dialog, IDC_PATH), FALSE);
|
||||
if (strlen(tmp_cflash_filename)) _OKbutton = TRUE;
|
||||
CheckDlgButton(dialog, IDC_RFILE, BST_CHECKED);
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -164,12 +168,11 @@ BOOL CALLBACK GbaSlotCFlash(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
|
|||
{
|
||||
if (HIWORD(wparam) == BN_CLICKED)
|
||||
{
|
||||
tmp_CFlashUsePath = FALSE;
|
||||
tmp_CFlashMode = ADDON_CFLASH_MODE_File;
|
||||
EnableWindow(GetDlgItem(dialog, IDC_PATHIMG), TRUE);
|
||||
EnableWindow(GetDlgItem(dialog, IDC_BBROWSE), TRUE);
|
||||
|
||||
EnableWindow(GetDlgItem(dialog, IDC_BBROWSE2), FALSE);
|
||||
EnableWindow(GetDlgItem(dialog, IDC_PATHDESMUME), FALSE);
|
||||
EnableWindow(GetDlgItem(dialog, IDC_PATH), FALSE);
|
||||
|
||||
if (!strlen(tmp_cflash_filename))
|
||||
|
@ -182,48 +185,30 @@ BOOL CALLBACK GbaSlotCFlash(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
|
|||
{
|
||||
if (HIWORD(wparam) == BN_CLICKED)
|
||||
{
|
||||
tmp_CFlashUsePath = TRUE;
|
||||
tmp_CFlashMode = ADDON_CFLASH_MODE_Path;
|
||||
EnableWindow(GetDlgItem(dialog, IDC_PATHIMG), FALSE);
|
||||
EnableWindow(GetDlgItem(dialog, IDC_BBROWSE), FALSE);
|
||||
|
||||
if (IsDlgButtonChecked(dialog, IDC_PATHDESMUME))
|
||||
{
|
||||
tmp_CFlashUseRomPath = TRUE;
|
||||
EnableWindow(GetDlgItem(dialog, IDC_BBROWSE2), FALSE);
|
||||
EnableWindow(GetDlgItem(dialog, IDC_PATH), FALSE);
|
||||
EnableWindow(OKbutton, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp_CFlashUseRomPath = FALSE;
|
||||
EnableWindow(GetDlgItem(dialog, IDC_BBROWSE2), TRUE);
|
||||
EnableWindow(GetDlgItem(dialog, IDC_PATH), TRUE);
|
||||
}
|
||||
|
||||
EnableWindow(GetDlgItem(dialog, IDC_PATHDESMUME), TRUE);
|
||||
EnableWindow(GetDlgItem(dialog, IDC_BBROWSE2), TRUE);
|
||||
EnableWindow(GetDlgItem(dialog, IDC_PATH), TRUE);
|
||||
if (!strlen(tmp_cflash_path))
|
||||
EnableWindow(OKbutton, FALSE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case IDC_PATHDESMUME:
|
||||
{
|
||||
if (IsDlgButtonChecked(dialog, IDC_PATHDESMUME))
|
||||
if (HIWORD(wparam) == BN_CLICKED)
|
||||
{
|
||||
tmp_CFlashUseRomPath = TRUE;
|
||||
tmp_CFlashMode = ADDON_CFLASH_MODE_RomPath;
|
||||
EnableWindow(GetDlgItem(dialog, IDC_PATHIMG), FALSE);
|
||||
EnableWindow(GetDlgItem(dialog, IDC_BBROWSE), FALSE);
|
||||
|
||||
EnableWindow(GetDlgItem(dialog, IDC_BBROWSE2), FALSE);
|
||||
EnableWindow(GetDlgItem(dialog, IDC_PATH), FALSE);
|
||||
EnableWindow(OKbutton, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp_CFlashUseRomPath = FALSE;
|
||||
EnableWindow(GetDlgItem(dialog, IDC_BBROWSE2), TRUE);
|
||||
EnableWindow(GetDlgItem(dialog, IDC_PATH), TRUE);
|
||||
if (strlen(tmp_cflash_path))
|
||||
EnableWindow(OKbutton, TRUE);
|
||||
else
|
||||
EnableWindow(OKbutton, FALSE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -403,8 +388,7 @@ void GBAslotDialog(HWND hwnd)
|
|||
strcpy(tmp_cflash_filename, CFlashName.c_str());
|
||||
strcpy(tmp_cflash_path, CFlashPath.c_str());
|
||||
strcpy(tmp_gbagame_filename, GBAgameName);
|
||||
tmp_CFlashUseRomPath = (CFlash_Mode==ADDON_CFLASH_MODE_RomPath);
|
||||
tmp_CFlashUsePath = (CFlash_Mode==ADDON_CFLASH_MODE_Path);
|
||||
tmp_CFlashMode = CFlash_Mode;
|
||||
_OKbutton = false;
|
||||
u32 res=DialogBox(hAppInst, MAKEINTRESOURCE(IDD_GBASLOT), hwnd, (DLGPROC) GbaSlotBox_Proc);
|
||||
if (res)
|
||||
|
@ -414,22 +398,17 @@ void GBAslotDialog(HWND hwnd)
|
|||
case NDS_ADDON_NONE:
|
||||
break;
|
||||
case NDS_ADDON_CFLASH:
|
||||
if(tmp_CFlashUsePath) CFlash_Mode=ADDON_CFLASH_MODE_Path;
|
||||
WritePrivateProfileInt("GBAslot.CFlash","usePath",tmp_CFlashUsePath,IniName);
|
||||
if (tmp_CFlashUsePath)
|
||||
{
|
||||
if (tmp_CFlashUseRomPath)
|
||||
{
|
||||
CFlash_Mode=ADDON_CFLASH_MODE_RomPath;
|
||||
WritePrivateProfileInt("GBAslot.CFlash","useRomPath",tmp_CFlashUseRomPath,IniName);
|
||||
break;
|
||||
}
|
||||
CFlashPath = tmp_cflash_path;
|
||||
WritePrivateProfileString("GBAslot.CFlash","path",tmp_cflash_path,IniName);
|
||||
break;
|
||||
}
|
||||
CFlashName = tmp_cflash_filename;
|
||||
CFlash_Mode = tmp_CFlashMode;
|
||||
WritePrivateProfileInt("GBAslot.CFlash","fileMode",CFlash_Mode,IniName);
|
||||
WritePrivateProfileString("GBAslot.CFlash","path",tmp_cflash_path,IniName);
|
||||
WritePrivateProfileString("GBAslot.CFlash","filename",tmp_cflash_filename,IniName);
|
||||
if(CFlash_Mode == ADDON_CFLASH_MODE_Path)
|
||||
CFlash_Path = tmp_cflash_path;
|
||||
else if(CFlash_Mode == ADDON_CFLASH_MODE_RomPath)
|
||||
CFlash_Path = "";
|
||||
else
|
||||
CFlash_Path = tmp_cflash_filename;
|
||||
|
||||
break;
|
||||
case NDS_ADDON_RUMBLEPAK:
|
||||
break;
|
||||
|
@ -442,14 +421,6 @@ void GBAslotDialog(HWND hwnd)
|
|||
}
|
||||
WritePrivateProfileInt("GBAslot","type",temp_type,IniName);
|
||||
|
||||
if(CFlash_Mode == ADDON_CFLASH_MODE_Path)
|
||||
CFlash_Path = CFlashPath;
|
||||
else if(CFlash_Mode == ADDON_CFLASH_MODE_RomPath)
|
||||
CFlash_Path = "";
|
||||
else
|
||||
CFlash_Path = CFlashName;
|
||||
|
||||
|
||||
addon_type = temp_type;
|
||||
addonsChangePak(addon_type);
|
||||
if (romloaded)
|
||||
|
|
|
@ -1492,23 +1492,28 @@ int _main()
|
|||
GetINIPath();
|
||||
|
||||
addon_type = GetPrivateProfileInt("GBAslot", "type", NDS_ADDON_NONE, IniName);
|
||||
UINT CFlashUsePath = GetPrivateProfileInt("GBAslot.CFlash", "usePath", 1, IniName);
|
||||
UINT CFlashUseRomPath = GetPrivateProfileInt("GBAslot.CFlash", "useRomPath", 1, IniName);
|
||||
UINT CFlashFileMode = GetPrivateProfileInt("GBAslot.CFlash", "fileMode", 2, IniName);
|
||||
|
||||
CFlashPath = GetPrivateProfileStdString("GBAslot.CFlash", "path", "");
|
||||
CFlashName = GetPrivateProfileStdString("GBAslot.CFlash", "filename", "");
|
||||
GetPrivateProfileString("GBAslot.GBAgame", "filename", "", GBAgameName, MAX_PATH, IniName);
|
||||
|
||||
if(CFlashUsePath) {
|
||||
if(CFlashFileMode==ADDON_CFLASH_MODE_Path)
|
||||
{
|
||||
CFlash_Mode = ADDON_CFLASH_MODE_Path;
|
||||
CFlash_Path = CFlashPath;
|
||||
}
|
||||
else if(CFlashUseRomPath) {
|
||||
CFlash_Mode = ADDON_CFLASH_MODE_RomPath;
|
||||
} else {
|
||||
CFlash_Path = CFlashName;
|
||||
CFlash_Mode = ADDON_CFLASH_MODE_RomPath;
|
||||
}
|
||||
else
|
||||
if(CFlashFileMode==ADDON_CFLASH_MODE_File)
|
||||
{
|
||||
CFlash_Path = CFlashName;
|
||||
CFlash_Mode = ADDON_CFLASH_MODE_File;
|
||||
}
|
||||
else
|
||||
{
|
||||
CFlash_Path = "";
|
||||
CFlash_Mode = ADDON_CFLASH_MODE_RomPath;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue