cellGame, cellSysutil and TRP installer improved

* TRP Loader and sceNpTrophyRegisterContext improved.
* cellSysutil constants moved to cellSysutil.h
* cellGameBootCheck bug fixed that makes size->hddFreeSizeKB be 0.
* Added system language selector (this is *not* RPCS3's language).
cellSysutilGetSystemParamInt(0x111) will return the selected language.

NOTE: The problems caused by the last commit (pull request #104 merged)
are not yet fixed.
This commit is contained in:
Alexandro Sánchez Bach 2014-03-17 20:34:19 +01:00
parent 9786c036d5
commit cf4501fe41
8 changed files with 270 additions and 162 deletions

View File

@ -116,14 +116,10 @@ int cellGameBootCheck(mem32_t type, mem32_t attributes, mem_ptr_t<CellGameConten
type.GetAddr(), attributes.GetAddr(), size.GetAddr(), dirName.GetAddr());
if (!type.IsGood() || !attributes.IsGood() || !size.IsGood() || !dirName.IsGood())
{
cellGame.Warning("cellGameBootCheck returns CELL_GAME_ERROR_PARAM. As a result size->hddFreeSizeKB may be 0.");
return CELL_GAME_ERROR_PARAM;
// TODO: Locate the PARAM.SFO. The following path may be wrong.
vfsFile f("/app_home/PARAM.SFO");
PSFLoader psf(f);
if(!psf.Load(false))
return CELL_GAME_ERROR_FAILURE;
wxString dir = psf.m_info.serial(0,4) + psf.m_info.serial(5,5);
}
// TODO: Only works for HDD games
type = CELL_GAME_GAMETYPE_HDD;
@ -131,6 +127,13 @@ int cellGameBootCheck(mem32_t type, mem32_t attributes, mem_ptr_t<CellGameConten
size->hddFreeSizeKB = 40000000; //40 GB, TODO: Use the free space of the computer's HDD where RPCS3 is being run.
size->sizeKB = CELL_GAME_SIZEKB_NOTCALC;
size->sysSizeKB = 0;
// TODO: Locate the PARAM.SFO. The following path may be wrong.
vfsFile f("/app_home/PARAM.SFO");
PSFLoader psf(f);
if(!psf.Load(false))
return CELL_GAME_ERROR_FAILURE;
wxString dir = psf.m_info.serial(0,4) + psf.m_info.serial(5,5);
Memory.WriteString(dirName.GetAddr(), dir);
return CELL_OK;

View File

@ -3,145 +3,7 @@
#include "Emu/SysCalls/SC_FUNC.h"
#include "Emu/Audio/sysutil_audio.h"
// Parameter IDs
enum
{
//Integers
CELL_SYSUTIL_SYSTEMPARAM_ID_LANG = 0x0111,
CELL_SYSUTIL_SYSTEMPARAM_ID_ENTER_BUTTON_ASSIGN = 0x0112,
CELL_SYSUTIL_SYSTEMPARAM_ID_DATE_FORMAT = 0x0114,
CELL_SYSUTIL_SYSTEMPARAM_ID_TIME_FORMAT = 0x0115,
CELL_SYSUTIL_SYSTEMPARAM_ID_TIMEZONE = 0x0116,
CELL_SYSUTIL_SYSTEMPARAM_ID_SUMMERTIME = 0x0117,
CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL = 0x0121,
CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL0_RESTRICT = 0x0123,
CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USER_HAS_NP_ACCOUNT = 0x0141,
CELL_SYSUTIL_SYSTEMPARAM_ID_CAMERA_PLFREQ = 0x0151,
CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_RUMBLE = 0x0152,
CELL_SYSUTIL_SYSTEMPARAM_ID_KEYBOARD_TYPE = 0x0153,
CELL_SYSUTIL_SYSTEMPARAM_ID_JAPANESE_KEYBOARD_ENTRY_METHOD = 0x0154,
CELL_SYSUTIL_SYSTEMPARAM_ID_CHINESE_KEYBOARD_ENTRY_METHOD = 0x0155,
CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_AUTOOFF = 0x0156,
//Strings
CELL_SYSUTIL_SYSTEMPARAM_ID_NICKNAME = 0x113,
CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USERNAME = 0x131,
};
enum
{
CELL_SYSUTIL_LANG_JAPANESE = 0,
CELL_SYSUTIL_LANG_ENGLISH_US = 1,
CELL_SYSUTIL_LANG_FRENCH = 2,
CELL_SYSUTIL_LANG_SPANISH = 3,
CELL_SYSUTIL_LANG_GERMAN = 4,
CELL_SYSUTIL_LANG_ITALIAN = 5,
CELL_SYSUTIL_LANG_DUTCH = 6,
CELL_SYSUTIL_LANG_PORTUGUESE_PT = 7,
CELL_SYSUTIL_LANG_RUSSIAN = 8,
CELL_SYSUTIL_LANG_KOREAN = 9,
CELL_SYSUTIL_LANG_CHINESE_T = 10,
CELL_SYSUTIL_LANG_CHINESE_S = 11,
CELL_SYSUTIL_LANG_FINNISH = 12,
CELL_SYSUTIL_LANG_SWEDISH = 13,
CELL_SYSUTIL_LANG_DANISH = 14,
CELL_SYSUTIL_LANG_NORWEGIAN = 15,
CELL_SYSUTIL_LANG_POLISH = 16,
CELL_SYSUTIL_LANG_PORTUGUESE_BR = 17,
CELL_SYSUTIL_LANG_ENGLISH_GB = 18,
};
enum
{
CELL_SYSUTIL_ENTER_BUTTON_ASSIGN_CIRCLE = 0,
CELL_SYSUTIL_ENTER_BUTTON_ASSIGN_CROSS = 1,
};
enum
{
CELL_SYSUTIL_DATE_FMT_YYYYMMDD = 0,
CELL_SYSUTIL_DATE_FMT_DDMMYYYY = 1,
CELL_SYSUTIL_DATE_FMT_MMDDYYYY = 2,
};
enum
{
CELL_SYSUTIL_TIME_FMT_CLOCK12 = 0,
CELL_SYSUTIL_TIME_FMT_CLOCK24 = 1,
};
enum
{
CELL_SYSUTIL_GAME_PARENTAL_OFF = 0,
CELL_SYSUTIL_GAME_PARENTAL_LEVEL01 = 1,
CELL_SYSUTIL_GAME_PARENTAL_LEVEL02 = 2,
CELL_SYSUTIL_GAME_PARENTAL_LEVEL03 = 3,
CELL_SYSUTIL_GAME_PARENTAL_LEVEL04 = 4,
CELL_SYSUTIL_GAME_PARENTAL_LEVEL05 = 5,
CELL_SYSUTIL_GAME_PARENTAL_LEVEL06 = 6,
CELL_SYSUTIL_GAME_PARENTAL_LEVEL07 = 7,
CELL_SYSUTIL_GAME_PARENTAL_LEVEL08 = 8,
CELL_SYSUTIL_GAME_PARENTAL_LEVEL09 = 9,
CELL_SYSUTIL_GAME_PARENTAL_LEVEL10 = 10,
CELL_SYSUTIL_GAME_PARENTAL_LEVEL11 = 11,
};
enum
{
CELL_SYSUTIL_GAME_PARENTAL_LEVEL0_RESTRICT_OFF = 0,
CELL_SYSUTIL_GAME_PARENTAL_LEVEL0_RESTRICT_ON = 1,
};
enum
{
CELL_SYSUTIL_CAMERA_PLFREQ_DISABLED = 0,
CELL_SYSUTIL_CAMERA_PLFREQ_50HZ = 1,
CELL_SYSUTIL_CAMERA_PLFREQ_60HZ = 2,
CELL_SYSUTIL_CAMERA_PLFREQ_DEVCIE_DEPEND = 4,
};
enum
{
CELL_SYSUTIL_PAD_RUMBLE_OFF = 0,
CELL_SYSUTIL_PAD_RUMBLE_ON = 1,
};
enum
{
CELL_MSGDIALOG_BUTTON_NONE = -1,
CELL_MSGDIALOG_BUTTON_INVALID = 0,
CELL_MSGDIALOG_BUTTON_OK = 1,
CELL_MSGDIALOG_BUTTON_YES = 1,
CELL_MSGDIALOG_BUTTON_NO = 2,
CELL_MSGDIALOG_BUTTON_ESCAPE = 3,
};
enum{
CELL_SYSCACHE_RET_OK_CLEARED = 0,
CELL_SYSCACHE_RET_OK_RELAYED = 1,
CELL_SYSCACHE_ID_SIZE = 32,
CELL_SYSCACHE_PATH_MAX = 1055,
CELL_SYSCACHE_ERROR_ACCESS_ERROR = 0x8002bc01,//I don't think we need this
CELL_SYSCACHE_ERROR_INTERNAL = 0x8002bc02,//not really useful, if we run out of HD space sysfs should handle that
CELL_SYSCACHE_ERROR_PARAM = 0x8002bc03,
CELL_SYSCACHE_ERROR_NOTMOUNTED = 0x8002bc04,//we don't really need to simulate the mounting, so this is probably useless
};
enum CellMsgDialogType
{
CELL_MSGDIALOG_DIALOG_TYPE_ERROR = 0x00000000,
CELL_MSGDIALOG_DIALOG_TYPE_NORMAL = 0x00000001,
CELL_MSGDIALOG_BUTTON_TYPE_NONE = 0x00000000,
CELL_MSGDIALOG_BUTTON_TYPE_YESNO = 0x00000010,
CELL_MSGDIALOG_DEFAULT_CURSOR_YES = 0x00000000,
CELL_MSGDIALOG_DEFAULT_CURSOR_NO = 0x00000100,
};
#include "cellSysutil.h"
typedef void (*CellMsgDialogCallback)(int buttonType, mem_ptr_t<void> userData);
@ -161,7 +23,7 @@ int cellSysutilGetSystemParamInt(int id, mem32_t value)
{
case CELL_SYSUTIL_SYSTEMPARAM_ID_LANG:
cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_LANG");
value = CELL_SYSUTIL_LANG_ENGLISH_US;
value = Ini.SysLanguage.GetValue();
break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_ENTER_BUTTON_ASSIGN:

View File

@ -0,0 +1,142 @@
#pragma once
// Parameter IDs
enum
{
// Integers
CELL_SYSUTIL_SYSTEMPARAM_ID_LANG = 0x0111,
CELL_SYSUTIL_SYSTEMPARAM_ID_ENTER_BUTTON_ASSIGN = 0x0112,
CELL_SYSUTIL_SYSTEMPARAM_ID_DATE_FORMAT = 0x0114,
CELL_SYSUTIL_SYSTEMPARAM_ID_TIME_FORMAT = 0x0115,
CELL_SYSUTIL_SYSTEMPARAM_ID_TIMEZONE = 0x0116,
CELL_SYSUTIL_SYSTEMPARAM_ID_SUMMERTIME = 0x0117,
CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL = 0x0121,
CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL0_RESTRICT = 0x0123,
CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USER_HAS_NP_ACCOUNT = 0x0141,
CELL_SYSUTIL_SYSTEMPARAM_ID_CAMERA_PLFREQ = 0x0151,
CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_RUMBLE = 0x0152,
CELL_SYSUTIL_SYSTEMPARAM_ID_KEYBOARD_TYPE = 0x0153,
CELL_SYSUTIL_SYSTEMPARAM_ID_JAPANESE_KEYBOARD_ENTRY_METHOD = 0x0154,
CELL_SYSUTIL_SYSTEMPARAM_ID_CHINESE_KEYBOARD_ENTRY_METHOD = 0x0155,
CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_AUTOOFF = 0x0156,
// Strings
CELL_SYSUTIL_SYSTEMPARAM_ID_NICKNAME = 0x113,
CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USERNAME = 0x131,
};
enum
{
CELL_SYSUTIL_LANG_JAPANESE = 0,
CELL_SYSUTIL_LANG_ENGLISH_US = 1,
CELL_SYSUTIL_LANG_FRENCH = 2,
CELL_SYSUTIL_LANG_SPANISH = 3,
CELL_SYSUTIL_LANG_GERMAN = 4,
CELL_SYSUTIL_LANG_ITALIAN = 5,
CELL_SYSUTIL_LANG_DUTCH = 6,
CELL_SYSUTIL_LANG_PORTUGUESE_PT = 7,
CELL_SYSUTIL_LANG_RUSSIAN = 8,
CELL_SYSUTIL_LANG_KOREAN = 9,
CELL_SYSUTIL_LANG_CHINESE_T = 10,
CELL_SYSUTIL_LANG_CHINESE_S = 11,
CELL_SYSUTIL_LANG_FINNISH = 12,
CELL_SYSUTIL_LANG_SWEDISH = 13,
CELL_SYSUTIL_LANG_DANISH = 14,
CELL_SYSUTIL_LANG_NORWEGIAN = 15,
CELL_SYSUTIL_LANG_POLISH = 16,
CELL_SYSUTIL_LANG_PORTUGUESE_BR = 17,
CELL_SYSUTIL_LANG_ENGLISH_GB = 18,
};
enum
{
CELL_SYSUTIL_ENTER_BUTTON_ASSIGN_CIRCLE = 0,
CELL_SYSUTIL_ENTER_BUTTON_ASSIGN_CROSS = 1,
};
enum
{
CELL_SYSUTIL_DATE_FMT_YYYYMMDD = 0,
CELL_SYSUTIL_DATE_FMT_DDMMYYYY = 1,
CELL_SYSUTIL_DATE_FMT_MMDDYYYY = 2,
};
enum
{
CELL_SYSUTIL_TIME_FMT_CLOCK12 = 0,
CELL_SYSUTIL_TIME_FMT_CLOCK24 = 1,
};
enum
{
CELL_SYSUTIL_GAME_PARENTAL_OFF = 0,
CELL_SYSUTIL_GAME_PARENTAL_LEVEL01 = 1,
CELL_SYSUTIL_GAME_PARENTAL_LEVEL02 = 2,
CELL_SYSUTIL_GAME_PARENTAL_LEVEL03 = 3,
CELL_SYSUTIL_GAME_PARENTAL_LEVEL04 = 4,
CELL_SYSUTIL_GAME_PARENTAL_LEVEL05 = 5,
CELL_SYSUTIL_GAME_PARENTAL_LEVEL06 = 6,
CELL_SYSUTIL_GAME_PARENTAL_LEVEL07 = 7,
CELL_SYSUTIL_GAME_PARENTAL_LEVEL08 = 8,
CELL_SYSUTIL_GAME_PARENTAL_LEVEL09 = 9,
CELL_SYSUTIL_GAME_PARENTAL_LEVEL10 = 10,
CELL_SYSUTIL_GAME_PARENTAL_LEVEL11 = 11,
};
enum
{
CELL_SYSUTIL_GAME_PARENTAL_LEVEL0_RESTRICT_OFF = 0,
CELL_SYSUTIL_GAME_PARENTAL_LEVEL0_RESTRICT_ON = 1,
};
enum
{
CELL_SYSUTIL_CAMERA_PLFREQ_DISABLED = 0,
CELL_SYSUTIL_CAMERA_PLFREQ_50HZ = 1,
CELL_SYSUTIL_CAMERA_PLFREQ_60HZ = 2,
CELL_SYSUTIL_CAMERA_PLFREQ_DEVCIE_DEPEND = 4,
};
enum
{
CELL_SYSUTIL_PAD_RUMBLE_OFF = 0,
CELL_SYSUTIL_PAD_RUMBLE_ON = 1,
};
enum
{
CELL_MSGDIALOG_BUTTON_NONE = -1,
CELL_MSGDIALOG_BUTTON_INVALID = 0,
CELL_MSGDIALOG_BUTTON_OK = 1,
CELL_MSGDIALOG_BUTTON_YES = 1,
CELL_MSGDIALOG_BUTTON_NO = 2,
CELL_MSGDIALOG_BUTTON_ESCAPE = 3,
};
enum
{
CELL_SYSCACHE_RET_OK_CLEARED = 0,
CELL_SYSCACHE_RET_OK_RELAYED = 1,
CELL_SYSCACHE_ID_SIZE = 32,
CELL_SYSCACHE_PATH_MAX = 1055,
CELL_SYSCACHE_ERROR_ACCESS_ERROR = 0x8002bc01, // I don't think we need this
CELL_SYSCACHE_ERROR_INTERNAL = 0x8002bc02, // Not really useful, if we run out of HDD space sys_fs should handle that
CELL_SYSCACHE_ERROR_PARAM = 0x8002bc03,
CELL_SYSCACHE_ERROR_NOTMOUNTED = 0x8002bc04, // We don't really need to simulate the mounting, so this is probably useless
};
enum CellMsgDialogType
{
CELL_MSGDIALOG_DIALOG_TYPE_ERROR = 0x00000000,
CELL_MSGDIALOG_DIALOG_TYPE_NORMAL = 0x00000001,
CELL_MSGDIALOG_BUTTON_TYPE_NONE = 0x00000000,
CELL_MSGDIALOG_BUTTON_TYPE_YESNO = 0x00000010,
CELL_MSGDIALOG_DEFAULT_CURSOR_YES = 0x00000000,
CELL_MSGDIALOG_DEFAULT_CURSOR_NO = 0x00000100,
};

View File

@ -4,6 +4,7 @@
#include "sceNp.h"
#include "sceNpTrophy.h"
#include "Loader/TRP.h"
void sceNpTrophy_unload();
@ -116,23 +117,44 @@ int sceNpTrophyRegisterContext(u32 context, u32 handle, u32 statusCb_addr, u32 a
// TODO: There are other possible errors
sceNpTrophyInternalContext& ctxt = s_npTrophyInstance.contexts[context];
if (!ctxt.trp_stream)
return SCE_NP_TROPHY_ERROR_CONF_DOES_NOT_EXIST;
int ret;
TRPLoader trp(*(ctxt.trp_stream));
if (!trp.LoadHeader())
return SCE_NP_TROPHY_ERROR_ILLEGAL_UPDATE;
// Rename or discard certain entries based on the files found
char target [32];
sprintf(target, "TROP_%02d.SFM", Ini.SysLanguage.GetValue());
if (trp.ContainsEntry(target)) {
trp.RemoveEntry("TROPCONF.SFM");
trp.RemoveEntry("TROP.SFM");
trp.RenameEntry(target, "TROPCONF.SFM");
}
else if (trp.ContainsEntry("TROP.SFM")) {
trp.RemoveEntry("TROPCONF.SFM");
trp.RenameEntry("TROP.SFM", "TROPCONF.SFM");
}
else if (!trp.ContainsEntry("TROPCONF.SFM")) {
return SCE_NP_TROPHY_ERROR_ILLEGAL_UPDATE;
}
// Discard unnecessary TROP_XX.SFM files
for (int i=0; i<=18; i++) {
sprintf(target, "TROP_%02d.SFM", i);
if (i != Ini.SysLanguage.GetValue())
trp.RemoveEntry(target);
}
// TODO: Get the path of the current user
if (trp.Install("/dev_hdd0/home/00000001/trophy/" + ctxt.trp_name))
ret = CELL_OK;
else
ret = SCE_NP_TROPHY_ERROR_ILLEGAL_UPDATE;
if (!trp.Install("/dev_hdd0/home/00000001/trophy/" + ctxt.trp_name))
return SCE_NP_TROPHY_ERROR_ILLEGAL_UPDATE;
// TODO: Callbacks
trp.Close();
return ret;
return CELL_OK;
}
int sceNpTrophyGetGameProgress()

View File

@ -328,6 +328,7 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event))
wxBoxSizer* s_panel(new wxBoxSizer(wxHORIZONTAL));
wxBoxSizer* s_subpanel1(new wxBoxSizer(wxVERTICAL));
wxBoxSizer* s_subpanel2(new wxBoxSizer(wxVERTICAL));
wxBoxSizer* s_subpanel3(new wxBoxSizer(wxVERTICAL));
wxStaticBoxSizer* s_round_cpu( new wxStaticBoxSizer( wxVERTICAL, &diag, _("CPU") ) );
wxStaticBoxSizer* s_round_cpu_decoder( new wxStaticBoxSizer( wxVERTICAL, &diag, _("Decoder") ) );
@ -348,6 +349,9 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event))
wxStaticBoxSizer* s_round_hle( new wxStaticBoxSizer( wxVERTICAL, &diag, _("HLE / Misc.") ) );
wxStaticBoxSizer* s_round_hle_log_lvl( new wxStaticBoxSizer( wxVERTICAL, &diag, _("Log lvl") ) );
wxStaticBoxSizer* s_round_sys( new wxStaticBoxSizer( wxVERTICAL, &diag, _("System") ) );
wxStaticBoxSizer* s_round_sys_lang( new wxStaticBoxSizer( wxVERTICAL, &diag, _("Language") ) );
wxComboBox* cbox_cpu_decoder = new wxComboBox(&diag, wxID_ANY);
wxComboBox* cbox_gs_render = new wxComboBox(&diag, wxID_ANY);
wxComboBox* cbox_gs_resolution = new wxComboBox(&diag, wxID_ANY);
@ -357,6 +361,7 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event))
wxComboBox* cbox_mouse_handler = new wxComboBox(&diag, wxID_ANY);
wxComboBox* cbox_audio_out = new wxComboBox(&diag, wxID_ANY);
wxComboBox* cbox_hle_loglvl = new wxComboBox(&diag, wxID_ANY);
wxComboBox* cbox_sys_lang = new wxComboBox(&diag, wxID_ANY);
wxCheckBox* chbox_cpu_ignore_rwerrors = new wxCheckBox(&diag, wxID_ANY, "Ignore Read/Write errors");
wxCheckBox* chbox_gs_log_prog = new wxCheckBox(&diag, wxID_ANY, "Log vertex/fragment programs");
@ -405,6 +410,25 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event))
cbox_hle_loglvl->Append("Errors");
cbox_hle_loglvl->Append("Nothing");
cbox_sys_lang->Append("Japanese");
cbox_sys_lang->Append("English (US)");
cbox_sys_lang->Append("French");
cbox_sys_lang->Append("Spanish");
cbox_sys_lang->Append("German");
cbox_sys_lang->Append("Italian");
cbox_sys_lang->Append("Dutch");
cbox_sys_lang->Append("Portuguese (PT)");
cbox_sys_lang->Append("Russian");
cbox_sys_lang->Append("Korean");
cbox_sys_lang->Append("Chinese (Trad.)");
cbox_sys_lang->Append("Chinese (Simp.)");
cbox_sys_lang->Append("Finnish");
cbox_sys_lang->Append("Swedish");
cbox_sys_lang->Append("Danish");
cbox_sys_lang->Append("Norwegian");
cbox_sys_lang->Append("Polish");
cbox_sys_lang->Append("English (UK)");
chbox_cpu_ignore_rwerrors->SetValue(Ini.CPUIgnoreRWErrors.GetValue());
chbox_gs_log_prog->SetValue(Ini.GSLogPrograms.GetValue());
chbox_gs_dump_depth->SetValue(Ini.GSDumpDepthBuffer.GetValue());
@ -428,6 +452,7 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event))
cbox_mouse_handler->SetSelection(Ini.MouseHandlerMode.GetValue());
cbox_audio_out->SetSelection(Ini.AudioOutMode.GetValue());
cbox_hle_loglvl->SetSelection(Ini.HLELogLvl.GetValue());
cbox_sys_lang->SetSelection(Ini.SysLanguage.GetValue());
s_round_cpu_decoder->Add(cbox_cpu_decoder, wxSizerFlags().Border(wxALL, 5).Expand());
s_round_cpu->Add(s_round_cpu_decoder, wxSizerFlags().Border(wxALL, 5).Expand());
@ -461,6 +486,9 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event))
s_round_hle->Add(chbox_hle_savetty, wxSizerFlags().Border(wxALL, 5).Expand());
s_round_hle->Add(chbox_hle_exitonstop, wxSizerFlags().Border(wxALL, 5).Expand());
s_round_sys_lang->Add(cbox_sys_lang, wxSizerFlags().Border(wxALL, 5).Expand());
s_round_sys->Add(s_round_sys_lang, wxSizerFlags().Border(wxALL, 5).Expand());
wxBoxSizer* s_b_panel(new wxBoxSizer(wxHORIZONTAL));
s_b_panel->Add(new wxButton(&diag, wxID_OK), wxSizerFlags().Border(wxALL, 5).Center());
@ -474,9 +502,11 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event))
s_subpanel2->Add(s_round_io, wxSizerFlags().Border(wxALL, 5).Expand());
s_subpanel2->Add(s_round_audio, wxSizerFlags().Border(wxALL, 5).Expand());
s_subpanel2->Add(s_round_hle, wxSizerFlags().Border(wxALL, 5).Expand());
s_subpanel3->Add(s_round_sys, wxSizerFlags().Border(wxALL, 5).Expand());
s_panel->Add(s_subpanel1, wxSizerFlags().Border(wxALL, 5).Expand());
s_panel->Add(s_subpanel2, wxSizerFlags().Border(wxALL, 5).Expand());
s_panel->Add(s_subpanel3, wxSizerFlags().Border(wxALL, 5).Expand());
diag.SetSizerAndFit( s_panel );
@ -500,6 +530,7 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event))
Ini.HLESaveTTY.SetValue(chbox_hle_savetty->GetValue());
Ini.HLEExitOnStop.SetValue(chbox_hle_exitonstop->GetValue());
Ini.HLELogLvl.SetValue(cbox_hle_loglvl->GetSelection());
Ini.SysLanguage.SetValue(cbox_sys_lang->GetSelection());
Ini.Save();
}

View File

@ -110,6 +110,7 @@ public:
IniEntry<bool> HLESaveTTY;
IniEntry<bool> HLEExitOnStop;
IniEntry<u8> HLELogLvl;
IniEntry<u8> SysLanguage;
IniEntry<int> PadHandlerLeft;
IniEntry<int> PadHandlerDown;
@ -178,6 +179,9 @@ public:
HLESaveTTY.Init("HLESaveTTY", path);
HLEExitOnStop.Init("HLEExitOnStop", path);
HLELogLvl.Init("HLELogLvl", path);
path = DefPath + "/" + "System";
SysLanguage.Init("SysLanguage", path);
}
void Load()
@ -200,6 +204,7 @@ public:
HLESaveTTY.Load(false);
HLEExitOnStop.Load(false);
HLELogLvl.Load(0);
SysLanguage.Load(1);
PadHandlerLeft.Load(static_cast<int>('A'));
PadHandlerDown.Load(static_cast<int>('S'));
@ -239,6 +244,7 @@ public:
HLESaveTTY.Save();
HLEExitOnStop.Save();
HLELogLvl.Save();
SysLanguage.Save();
PadHandlerLeft.Save();
PadHandlerDown.Save();

View File

@ -5,10 +5,15 @@ TRPLoader::TRPLoader(vfsStream& f) : trp_f(f)
{
}
TRPLoader::~TRPLoader()
{
Close();
}
bool TRPLoader::Install(std::string dest, bool show)
{
if(!trp_f.IsOpened()) return false;
if(!LoadHeader(show)) return false;
if(!trp_f.IsOpened())
return false;
if (!dest.empty() && dest.back() != '/')
dest += '/';
@ -28,13 +33,11 @@ bool TRPLoader::Install(std::string dest, bool show)
return true;
}
bool TRPLoader::Close()
{
return trp_f.Close();
}
bool TRPLoader::LoadHeader(bool show)
{
if(!trp_f.IsOpened())
return false;
trp_f.Seek(0);
if (trp_f.Read(&m_header, sizeof(TRPHeader)) != sizeof(TRPHeader))
return false;
@ -59,3 +62,36 @@ bool TRPLoader::LoadHeader(bool show)
return true;
}
bool TRPLoader::ContainsEntry(char *filename)
{
for (const TRPEntry& entry : m_entries) {
if (!strcmp(entry.name, filename))
return true;
}
return false;
}
void TRPLoader::RemoveEntry(char *filename)
{
std::vector<TRPEntry>::iterator i = m_entries.begin();
while (i != m_entries.end()) {
if (!strcmp(i->name, filename))
i = m_entries.erase(i);
else
i++;
}
}
void TRPLoader::RenameEntry(char *oldname, char *newname)
{
for (const TRPEntry& entry : m_entries) {
if (!strcmp(entry.name, oldname))
memcpy((void*)entry.name, newname, 32);
}
}
bool TRPLoader::Close()
{
return trp_f.Close();
}

View File

@ -30,7 +30,13 @@ class TRPLoader
public:
TRPLoader(vfsStream& f);
~TRPLoader();
virtual bool Install(std::string dest, bool show = false);
virtual bool LoadHeader(bool show = false);
virtual bool ContainsEntry(char *filename);
virtual void RemoveEntry(char *filename);
virtual void RenameEntry(char *oldname, char *newname);
virtual bool Close();
};