win32: Add menu option to open memory stick directory

This commit is contained in:
Henrik Rydgard 2013-03-28 20:17:45 +01:00
parent 63463f7959
commit e7027b6c9c
7 changed files with 60 additions and 35 deletions

View File

@ -15,16 +15,13 @@
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#ifdef _WIN32
#include <windows.h>
#endif
#include "../Config.h"
#include "../Host.h"
#include "../SaveState.h"
#include "Core/Config.h"
#include "Core/System.h"
#include "Core/Host.h"
#include "Core/SaveState.h"
#include "HLE.h"
#include "../MIPS/MIPS.h"
#include "../HW/MemoryStick.h"
#include "Core/MIPS/MIPS.h"
#include "Core/HW/MemoryStick.h"
#include "Core/CoreTiming.h"
#include "Core/Reporting.h"
@ -244,31 +241,9 @@ void __IoInit() {
asyncNotifyEvent = CoreTiming::RegisterEvent("IoAsyncNotify", __IoAsyncNotify);
#ifdef _WIN32
char path_buffer[_MAX_PATH], drive[_MAX_DRIVE] ,dir[_MAX_DIR], file[_MAX_FNAME], ext[_MAX_EXT];
char memstickpath[_MAX_PATH];
char flash0path[_MAX_PATH];
GetModuleFileName(NULL,path_buffer,sizeof(path_buffer));
char *winpos = strstr(path_buffer, "Windows");
if (winpos)
*winpos = 0;
strcat(path_buffer, "dummy.txt");
_splitpath_s(path_buffer, drive, dir, file, ext );
// Mount a couple of filesystems
sprintf(memstickpath, "%s%smemstick\\", drive, dir);
sprintf(flash0path, "%s%sflash0\\", drive, dir);
#else
// TODO
std::string memstickpath = g_Config.memCardDirectory;
std::string flash0path = g_Config.flashDirectory;
#endif
std::string memstickpath;
std::string flash0path;
GetSysDirectories(memstickpath, flash0path);
DirectoryFileSystem *memstick = new DirectoryFileSystem(&pspFileSystem, memstickpath);
#ifdef ANDROID

View File

@ -390,6 +390,7 @@ const HLEFunction sceUmdUser[] =
{0xBD2BDE07,&WrapI_I<sceUmdUnRegisterUMDCallBack>,"sceUmdUnRegisterUMDCallBack"},
{0x87533940,WrapU_V<sceUmdReplaceProhibit>,"sceUmdReplaceProhibit"},
{0xCBE9F02A,WrapU_V<sceUmdReplacePermit>,"sceUmdReplacePermit"},
{0x20628E6F, 0, "sceUmdGetErrorStatFunction"},
};
void Register_sceUmdUser()

View File

@ -15,6 +15,12 @@
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#ifdef _WIN32
#define NOMINMAX
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#endif
#include "MemMap.h"
#include "MIPS/MIPS.h"
@ -122,3 +128,32 @@ CoreParameter &PSP_CoreParameter()
{
return coreParameter;
}
void GetSysDirectories(std::string &memstickpath, std::string &flash0path) {
#ifdef _WIN32
char path_buffer[_MAX_PATH], drive[_MAX_DRIVE] ,dir[_MAX_DIR], file[_MAX_FNAME], ext[_MAX_EXT];
char memstickpath_buf[_MAX_PATH];
char flash0path_buf[_MAX_PATH];
GetModuleFileName(NULL,path_buffer,sizeof(path_buffer));
char *winpos = strstr(path_buffer, "Windows");
if (winpos)
*winpos = 0;
strcat(path_buffer, "dummy.txt");
_splitpath_s(path_buffer, drive, dir, file, ext );
// Mount a couple of filesystems
sprintf(memstickpath_buf, "%s%smemstick\\", drive, dir);
sprintf(flash0path_buf, "%s%sflash0\\", drive, dir);
memstickpath = memstickpath_buf;
flash0path = flash0path_buf;
#else
// TODO
memstickpath = g_Config.memCardDirectory;
flash0path = g_Config.flashDirectory;
#endif
}

View File

@ -31,4 +31,7 @@ bool PSP_IsInited();
void PSP_Shutdown();
void PSP_HWAdvance(int cycles);
void PSP_SWI();
void GetSysDirectories(std::string &memstickpath, std::string &flash0path);
CoreParameter &PSP_CoreParameter();

View File

@ -288,6 +288,14 @@ namespace MainWindow
case ID_FILE_REFRESHGAMELIST:
break;
case ID_FILE_MEMSTICK:
{
std::string memStickDir, flash0dir;
GetSysDirectories(memStickDir, flash0dir);
ShellExecuteA(NULL, "open", memStickDir.c_str(), 0, 0, SW_SHOW);
}
break;
case ID_EMULATION_RUN:
if (g_State.bEmuThreadStarted)
{

View File

@ -206,6 +206,8 @@ BEGIN
MENUITEM "&Open...", ID_FILE_LOAD
MENUITEM "&Close", ID_EMULATION_STOP
MENUITEM SEPARATOR
MENUITEM "Open &Memory Stick", ID_FILE_MEMSTICK
MENUITEM SEPARATOR
MENUITEM "Quickload state\tF4", ID_FILE_QUICKLOADSTATE
MENUITEM "Quicksave state\tF2", ID_FILE_QUICKSAVESTATE
MENUITEM "&Load State File...", ID_FILE_LOADSTATEFILE

View File

@ -264,6 +264,7 @@
#define ID_OPTIONS_FRAMESKIP 40139
#define IDC_MEMCHECK 40140
#define ID_OPTIONS_USEMEDIAENGINE 40141
#define ID_FILE_MEMSTICK 40142
#define IDC_STATIC -1
// Next default values for new objects
@ -271,7 +272,7 @@
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 233
#define _APS_NEXT_COMMAND_VALUE 40141
#define _APS_NEXT_COMMAND_VALUE 40143
#define _APS_NEXT_CONTROL_VALUE 1163
#define _APS_NEXT_SYMED_VALUE 101
#endif