mirror of
https://github.com/libretro/ppsspp.git
synced 2024-11-27 10:20:49 +00:00
Add a simple extract file command.
Mostly useful for quickly/easily extracting pmf/atrac/etc. files.
This commit is contained in:
parent
b8a5eb47b6
commit
2618f2ed39
@ -559,7 +559,7 @@ bool GameBrowser::IsCurrentPathPinned() {
|
||||
}
|
||||
|
||||
const std::vector<std::string> GameBrowser::GetPinnedPaths() {
|
||||
#ifdef _WIN32
|
||||
#ifndef _WIN32
|
||||
static const std::string sepChars = "/";
|
||||
#else
|
||||
static const std::string sepChars = "/\\";
|
||||
@ -587,7 +587,7 @@ const std::vector<std::string> GameBrowser::GetPinnedPaths() {
|
||||
}
|
||||
|
||||
const std::string GameBrowser::GetBaseName(const std::string &path) {
|
||||
#ifdef _WIN32
|
||||
#ifndef _WIN32
|
||||
static const std::string sepChars = "/";
|
||||
#else
|
||||
static const std::string sepChars = "/\\";
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "util/text/utf8.h"
|
||||
|
||||
#include "Core/Debugger/SymbolMap.h"
|
||||
#include "Windows/InputBox.h"
|
||||
#include "Windows/OpenGLBase.h"
|
||||
#include "Windows/Debugger/Debugger_Disasm.h"
|
||||
#include "Windows/Debugger/Debugger_MemoryDlg.h"
|
||||
@ -48,6 +49,7 @@
|
||||
#include "Core/Config.h"
|
||||
#include "Core/MIPS/JitCommon/JitCommon.h"
|
||||
#include "Core/MIPS/JitCommon/JitBlockCache.h"
|
||||
#include "Core/FileSystems/MetaFileSystem.h"
|
||||
#include "Windows/EmuThread.h"
|
||||
|
||||
#include "resource.h"
|
||||
@ -1389,6 +1391,38 @@ namespace MainWindow
|
||||
memoryWindow[0]->Show(true);
|
||||
break;
|
||||
|
||||
case ID_DEBUG_EXTRACTFILE:
|
||||
{
|
||||
std::string filename;
|
||||
if (!InputBox_GetString(hInst, hwndMain, L"Disc filename", filename, filename)) {
|
||||
break;
|
||||
}
|
||||
|
||||
const char *lastSlash = strrchr(filename.c_str(), '/');
|
||||
if (lastSlash) {
|
||||
fn = lastSlash + 1;
|
||||
} else {
|
||||
fn = "";
|
||||
}
|
||||
|
||||
PSPFileInfo info = pspFileSystem.GetFileInfo(filename);
|
||||
if (!info.exists) {
|
||||
MessageBox(hwndMain, L"File does not exist.", L"Sorry",0);
|
||||
} else if (info.type == FILETYPE_DIRECTORY) {
|
||||
MessageBox(hwndMain, L"Cannot extract directories.", L"Sorry",0);
|
||||
} else if (W32Util::BrowseForFileName(false, hWnd, L"Save file as...", 0, L"0All files\0*.*\0\0", L"", fn)) {
|
||||
FILE *fp = fopen(fn.c_str(), "wb");
|
||||
u32 handle = pspFileSystem.OpenFile(filename, FILEACCESS_READ, "");
|
||||
u8 buffer[4096];
|
||||
while (pspFileSystem.ReadFile(handle, buffer, sizeof(buffer)) > 0) {
|
||||
fwrite(buffer, sizeof(buffer), 1, fp);
|
||||
}
|
||||
pspFileSystem.CloseFile(handle);
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_DEBUG_LOG:
|
||||
LogManager::GetInstance()->GetConsoleListener()->Show(LogManager::GetInstance()->GetConsoleListener()->Hidden());
|
||||
break;
|
||||
|
@ -407,6 +407,7 @@ BEGIN
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Disassembly", ID_DEBUG_DISASSEMBLY
|
||||
MENUITEM "GE Debugger...", ID_DEBUG_GEDEBUGGER
|
||||
MENUITEM "Extract File...", ID_DEBUG_EXTRACTFILE
|
||||
MENUITEM "Log Console", ID_DEBUG_LOG
|
||||
MENUITEM "Memory View...", ID_DEBUG_MEMORYVIEW
|
||||
END
|
||||
|
@ -298,6 +298,7 @@
|
||||
#define ID_MEMVIEW_COPYVALUE_16 40142
|
||||
#define ID_MEMVIEW_COPYVALUE_32 40143
|
||||
#define ID_EMULATION_SWITCH_UMD 40144
|
||||
#define ID_DEBUG_EXTRACTFILE 40145
|
||||
|
||||
// Dummy option to let the buffered rendering hotkey cycle through all the options.
|
||||
#define ID_OPTIONS_BUFFEREDRENDERINGDUMMY 40500
|
||||
|
Loading…
Reference in New Issue
Block a user