Skip to content

Commit

Permalink
PS1 Classics
Browse files Browse the repository at this point in the history
  • Loading branch information
clienthax committed Jun 23, 2018
1 parent 78ef205 commit 7c421f6
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
11 changes: 11 additions & 0 deletions rpcs3/Emu/Cell/Modules/cellPad.cpp
Expand Up @@ -726,6 +726,15 @@ s32 cellPadLddUnregisterController(s32 handle)
}


s32 sys_io_3733EA3C(u32 port_no, vm::ptr<u32> device_type, vm::ptr<CellPadData> 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);
Expand All @@ -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);
}
37 changes: 37 additions & 0 deletions rpcs3/Emu/System.cpp
Expand Up @@ -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/");

Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 7c421f6

Please sign in to comment.