From 8b449ce76c91d5ff7a2829b233befe7d6df4b24f Mon Sep 17 00:00:00 2001 From: clienthax Date: Sat, 23 Jun 2018 10:36:16 +0100 Subject: [PATCH] PS1 Classics --- rpcs3/Emu/Cell/Modules/cellPad.cpp | 11 +++++++++ rpcs3/Emu/System.cpp | 37 ++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/rpcs3/Emu/Cell/Modules/cellPad.cpp b/rpcs3/Emu/Cell/Modules/cellPad.cpp index 901fab8e5e..3bbb9cfa43 100644 --- a/rpcs3/Emu/Cell/Modules/cellPad.cpp +++ b/rpcs3/Emu/Cell/Modules/cellPad.cpp @@ -726,6 +726,15 @@ s32 cellPadLddUnregisterController(s32 handle) } +s32 sys_io_3733EA3C(u32 port_no, vm::ptr device_type, vm::ptr data) +{ + //Used by the ps1 emulator built into the firmware + //Seems to call the same function that getdataextra does + sys_io.trace("sys_io_3733EA3C(port_no=%d, device_type=*0x%x, data=*0x%x)", port_no, device_type, data); + return cellPadGetDataExtra(port_no, device_type, data); +} + + void cellPad_init() { REG_FUNC(sys_io, cellPadInit); @@ -749,4 +758,6 @@ void cellPad_init() REG_FUNC(sys_io, cellPadLddDataInsert); REG_FUNC(sys_io, cellPadLddGetPortNo); REG_FUNC(sys_io, cellPadLddUnregisterController); + + REG_FNID(sys_io, 0x3733EA3C, sys_io_3733EA3C); } diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index 5f3136bf43..bf94de6af7 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -294,6 +294,8 @@ void Emulator::Init() fs::create_dir(dev_hdd0 + "home/00000001/trophy/"); fs::write_file(dev_hdd0 + "home/00000001/localusername", fs::create + fs::excl + fs::write, "User"s); fs::create_dir(dev_hdd0 + "disc/"); + fs::create_dir(dev_hdd0 + "savedata/"); + fs::create_dir(dev_hdd0 + "savedata/vmc/"); fs::create_dir(dev_hdd1 + "cache/"); fs::create_dir(dev_hdd1 + "game/"); @@ -453,6 +455,7 @@ bool Emulator::BootGame(const std::string& path, bool direct, bool add_only) "/USRDIR/EBOOT.BIN", "/EBOOT.BIN", "/eboot.bin", + "/USRDIR/ISO.BIN.EDAT", }; if (direct && fs::exists(path)) @@ -894,6 +897,40 @@ void Emulator::Load(bool add_only) out << games; fs::file(fs::get_config_dir() + "/games.yml", fs::rewrite).write(out.c_str(), out.size()); } + else if (m_cat == "1P" && from_hdd0_game) + { + //PS1 Classics + LOG_NOTICE(LOADER, "PS1 Game: %s, %s", m_title_id, m_title); + + std::string gamePath = m_path.substr(m_path.find("/dev_hdd0/game/"), 24); + + LOG_NOTICE(LOADER, "Forcing manual lib loading mode"); + g_cfg.core.lib_loading.from_string(fmt::format("%s", lib_loading_type::manual)); + g_cfg.core.load_libraries.from_list({}); + + argv.resize(9); + argv[0] = "/dev_flash/ps1emu/ps1_newemu.self"; + argv[1] = m_title_id + "_mc1.VM1"; // virtual mc 1 /dev_hdd0/savedata/vmc/%argv[1]% + argv[2] = m_title_id + "_mc2.VM1"; // virtual mc 2 /dev_hdd0/savedata/vmc/%argv[2]% + argv[3] = "0082"; // region target + argv[4] = "1600"; // ??? arg4 600 / 1200 / 1600, resolution scale? (purely a guess, the numbers seem to match closely to resolutions tho) + argv[5] = gamePath; // ps1 game folder path (not the game serial) + argv[6] = "1"; // ??? arg6 1 ? + argv[7] = "2"; // ??? arg7 2 -- full screen on/off 2/1 ? + argv[8] = "1"; // ??? arg8 2 -- smoothing on/off = 1/0 ? + + //TODO, this seems like it would normally be done by sysutil etc + //Basically make 2 128KB memory cards 0 filled and let the games handle formatting. + + fs::file card_1_file(vfs::get("/dev_hdd0/savedata/vmc/" + argv[1]), fs::write + fs::create); + card_1_file.trunc(128 * 1024); + fs::file card_2_file(vfs::get("/dev_hdd0/savedata/vmc/" + argv[2]), fs::write + fs::create); + card_2_file.trunc(128 * 1024); + + //Rewrite the path to be the emulator + m_path = vfs::get(argv[0]); + + } else if (m_cat != "DG" && m_cat != "GD") { // Don't need /dev_bdvd