Skip to content

Commit

Permalink
win32: Add menu option to open memory stick directory
Browse files Browse the repository at this point in the history
  • Loading branch information
hrydgard committed Mar 28, 2013
1 parent 63463f7 commit e7027b6
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 35 deletions.
43 changes: 9 additions & 34 deletions Core/HLE/sceIo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions Core/HLE/sceUmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"},

This comment has been minimized.

Copy link
@unknownbrackets

unknownbrackets Mar 28, 2013

Collaborator

Hmm, this appears to be a duplicate?

{0x20628E6F,&WrapU_V<sceUmdGetErrorStat>,"sceUmdGetErrorStat"},

-[Unknown]

This comment has been minimized.

Copy link
@hrydgard

hrydgard Mar 28, 2013

Author Owner

Hm yes, oops. Wasn't supposed to be in this commit anyway.

};

void Register_sceUmdUser()
Expand Down
35 changes: 35 additions & 0 deletions Core/System.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
}
3 changes: 3 additions & 0 deletions Core/System.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
8 changes: 8 additions & 0 deletions Windows/WndMainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 2 additions & 0 deletions Windows/ppsspp.rc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion Windows/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,14 +264,15 @@
#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
//
#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
Expand Down

0 comments on commit e7027b6

Please sign in to comment.