- fix R4 (now scan directory on reset);
- add R4 new path type. now can select youself a directory to scan or auto select same as ROM;
winport:
- now in select Slot1 dialog (folder dialog) cursor autosets to current selected directory;
This commit is contained in:
mtabachenko 2013-11-05 11:13:39 +00:00
parent da29c3f483
commit e2f2bf6bb3
7 changed files with 90 additions and 13 deletions

View File

@ -50,6 +50,7 @@ CommandLine::CommandLine()
, _advanced_timing(-1)
, _slot1(NULL)
, _slot1_fat_dir(NULL)
, _slot1_fat_dir_type(false)
#ifdef HAVE_JIT
, _cpu_mode(-1)
, _jit_size(-1)

View File

@ -50,6 +50,7 @@ public:
std::string slot1;
std::string console_type;
std::string slot1_fat_dir;
bool _slot1_fat_dir_type;
#ifndef HOST_WINDOWS
int disable_sound;
int disable_limiter;

View File

@ -34,6 +34,9 @@ Since GCROMCTRL[26:24] can't represent 'data block size' of 1 or 2, it is assume
#include "NDSSystem.h"
#include "emufile.h"
#include "utils/vfat.h"
#include "path.h"
bool slot1_R4_path_type = false;
//-------
//fat-related common elements
@ -51,17 +54,24 @@ static void scanDir()
}
VFAT vfat;
if(vfat.build(fatDir.c_str(),16))
char buf[MAX_PATH] = {0};
if (slot1_R4_path_type)
path.getpath(path.ROMS, buf);
if(vfat.build(slot1_R4_path_type?buf:fatDir.c_str(), 16))
{
fatImage = vfat.detach();
}
}
void slot1_SetFatDir(const std::string& dir)
void slot1_SetFatDir(const std::string& dir, bool sameAsRom)
{
//printf("FAT path %s\n", dir.c_str());
fatDir = dir;
slot1_R4_path_type = sameAsRom;
if (!slot1_R4_path_type)
fatDir = dir;
}
std::string slot1_GetFatDir()
@ -116,8 +126,6 @@ void slot1_Shutdown()
bool slot1_Connect()
{
if (slot1_device_type == NDS_SLOT1_R4)
scanDir();
slot1_device->connect();
return true;
}
@ -141,6 +149,8 @@ void slot1_Reset()
//connect new device
slot1_device = slot1_List[slot1_device_type];
if (slot1_device_type == NDS_SLOT1_R4)
scanDir();
slot1_device->connect();
}
@ -152,8 +162,6 @@ bool slot1_Change(NDS_SLOT1_TYPE changeToType)
slot1_device->disconnect();
slot1_device_type = changeToType;
slot1_device = slot1_List[slot1_device_type];
if (changeToType == NDS_SLOT1_R4)
scanDir();
printf("Slot 1: %s\n", slot1_device->info()->name());
printf("sending eject signal to SLOT-1\n");
NDS_TriggerCardEjectIRQ();

View File

@ -121,7 +121,8 @@ bool slot1_Change(NDS_SLOT1_TYPE type);
//check on the current device
NDS_SLOT1_TYPE slot1_GetCurrentType();
void slot1_SetFatDir(const std::string& dir);
extern bool slot1_R4_path_type;
void slot1_SetFatDir(const std::string& dir, bool sameAsRom = false);
std::string slot1_GetFatDir();
EMUFILE* slot1_GetFatImage();

View File

@ -3153,6 +3153,10 @@ int _main()
// Slot 1 / Slot 2 (GBA slot)
cmdline.slot1_fat_dir = GetPrivateProfileStdString("Slot1", "fat_path", "");
cmdline._slot1_fat_dir_type = GetPrivateProfileBool("Slot1", "fat_path_type", false, IniName);
if (cmdline._slot1_fat_dir_type != 0 && cmdline._slot1_fat_dir_type != 1)
cmdline._slot1_fat_dir_type = 0;
slot1_R4_path_type = cmdline._slot1_fat_dir_type;
addon_type = (NDS_ADDON_TYPE)GetPrivateProfileInt("GBAslot", "type", NDS_ADDON_NONE, IniName);
win32_CFlash_cfgMode = GetPrivateProfileInt("GBAslot.CFlash", "fileMode", 2, IniName);
@ -3163,6 +3167,8 @@ int _main()
cmdline.process_addonCommands();
WIN_InstallCFlash();
slot1_R4_path_type = cmdline._slot1_fat_dir_type;
if(cmdline.is_cflash_configured)
{
addon_type = NDS_ADDON_CFLASH;

View File

@ -1393,9 +1393,11 @@ IDD_SLOT1_R4 DIALOGEX 7, 64, 302, 89
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE | WS_SYSMENU
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
PUSHBUTTON "Browse...",IDC_BROWSE,245,53,50,14
EDITTEXT IDC_PATH,9,54,231,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_TABSTOP
LTEXT "Directory to scan:",IDC_STATIC,11,42,239,8
CONTROL "Directory to scan:",IDC_RFOLDER,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,9,22,35,10
CONTROL "use path of the loaded ROM (not the same as ""ROM path"" in path configuration)",IDC_PATHDESMUME,
"Button",BS_AUTORADIOBUTTON,9,53,272,10
PUSHBUTTON "Browse...",IDC_BROWSE,245,33,50,14
EDITTEXT IDC_PATH,9,34,231,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_TABSTOP
END
IDD_IMPORT_SAVE_SIZE DIALOGEX 0, 0, 316, 113

View File

@ -31,10 +31,37 @@ NDS_SLOT1_TYPE temp_type_slot1 = NDS_SLOT1_NONE;
NDS_SLOT1_TYPE last_type_slot1 = NDS_SLOT1_NONE;
char tmp_fat_path[MAX_PATH] = {0};
char tmp_fs_path[MAX_PATH] = {0};
bool tmp_fat_path_type = false;
HWND OKbutton_slot1 = NULL;
bool _OKbutton_slot1 = false;
bool needReset_slot1 = true;
#define SLOT1_DEBUG_ID 20000
#define SLOT1_R4_ID 20001
INT CALLBACK Slot1_BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM pData)
{
TCHAR szDir[MAX_PATH];
switch(uMsg)
{
case BFFM_INITIALIZED:
if (pData == SLOT1_DEBUG_ID)
SendMessage(hwnd, BFFM_SETSELECTION, TRUE, (LPARAM)tmp_fs_path);
else
SendMessage(hwnd, BFFM_SETSELECTION, TRUE, (LPARAM)tmp_fat_path);
break;
case BFFM_SELCHANGED:
if (SHGetPathFromIDList((LPITEMIDLIST) lp, szDir))
{
SendMessage(hwnd,BFFM_SETSTATUSTEXT, 0, (LPARAM)szDir);
}
break;
}
return 0;
}
INT_PTR CALLBACK Slot1None(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
{
@ -75,7 +102,8 @@ INT_PTR CALLBACK Slot1Debug(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
bp.pszDisplayName=NULL;
bp.lpszTitle="Select directory for game files";
bp.ulFlags=BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE | BIF_USENEWUI;
bp.lpfn=NULL;
bp.lParam = SLOT1_DEBUG_ID;
bp.lpfn=Slot1_BrowseCallbackProc;
LPITEMIDLIST tmp = SHBrowseForFolder((LPBROWSEINFO)&bp);
if (tmp!=NULL)
@ -106,6 +134,19 @@ INT_PTR CALLBACK Slot1R4(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
{
SetWindowText(GetDlgItem(dialog, IDC_PATH), tmp_fat_path);
_OKbutton_slot1 = (tmp_fat_path!="");
if (!tmp_fat_path_type)
{
CheckDlgButton(dialog, IDC_RFOLDER, BST_CHECKED);
EnableWindow(GetDlgItem(dialog, IDC_BROWSE), true);
EnableWindow(GetDlgItem(dialog, IDC_PATH), true);
}
else
{
CheckDlgButton(dialog, IDC_PATHDESMUME, BST_CHECKED);
EnableWindow(GetDlgItem(dialog, IDC_BROWSE), false);
EnableWindow(GetDlgItem(dialog, IDC_PATH), false);
}
return TRUE;
}
@ -122,7 +163,8 @@ INT_PTR CALLBACK Slot1R4(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
bp.pszDisplayName=NULL;
bp.lpszTitle="Select directory for FAT image building";
bp.ulFlags=BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE | BIF_USENEWUI;
bp.lpfn=NULL;
bp.lParam = SLOT1_R4_ID;
bp.lpfn=Slot1_BrowseCallbackProc;
LPITEMIDLIST tmp = SHBrowseForFolder((LPBROWSEINFO)&bp);
if (tmp!=NULL)
@ -139,6 +181,18 @@ INT_PTR CALLBACK Slot1R4(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
EnableWindow(OKbutton_slot1, FALSE);
break;
}
case IDC_RFOLDER:
EnableWindow(GetDlgItem(dialog, IDC_BROWSE), true);
EnableWindow(GetDlgItem(dialog, IDC_PATH), true);
tmp_fat_path_type = false;
return TRUE;
case IDC_PATHDESMUME:
EnableWindow(GetDlgItem(dialog, IDC_BROWSE), false);
EnableWindow(GetDlgItem(dialog, IDC_PATH), false);
tmp_fat_path_type = true;
return TRUE;
}
}
}
@ -186,6 +240,7 @@ BOOL CALLBACK Slot1Box_Proc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
EnableWindow(OKbutton_slot1, TRUE);
else
EnableWindow(OKbutton_slot1, FALSE);
return TRUE;
}
@ -252,6 +307,7 @@ void slot1Dialog(HWND hwnd)
strcpy(tmp_fs_path, path.getpath(path.SLOT1D).c_str());
temp_type_slot1 = slot1_GetCurrentType();
last_type_slot1 = temp_type_slot1;
tmp_fat_path_type = slot1_R4_path_type;
_OKbutton_slot1 = false;
needReset_slot1 = true;
u32 res=DialogBoxW(hAppInst, MAKEINTRESOURCEW(IDD_SLOT1CONFIG), hwnd, (DLGPROC)Slot1Box_Proc);
@ -274,6 +330,8 @@ void slot1Dialog(HWND hwnd)
slot1_SetFatDir(tmp_fat_path);
WritePrivateProfileString("Slot1","FAT_path",tmp_fat_path,IniName);
}
WritePrivateProfileBool("Slot1","FAT_path_type",tmp_fat_path_type,IniName);
slot1_R4_path_type = tmp_fat_path_type;
break;
case NDS_SLOT1_RETAIL_NAND:
break;