PS1 Emulation: Difference between revisions
(→Embedded Game settings: Moved from talk page, all the names needs a review because we was using different terms) |
(→Game settings access: Moved from talkpage) |
||
Line 324: | Line 324: | ||
Like mentioned above config is created from 2x u32 values. Lets call first value command, and second value param.<br> | Like mentioned above config is created from 2x u32 values. Lets call first value command, and second value param.<br> | ||
Command is used to calculate address for param, and only param is stored on obtained address.<br> | Command is used to calculate address for param, and only param is stored on obtained address.<br> | ||
Emulator then check for params, and if found (usually when not zero) apply settings based on them. | Emulator then check for params, and if found (usually when not zero) apply settings based on them.<br> | ||
Beside functions that read command params directly, every emulator have function (madeup name) ReadInternalConfigValue(u32 command_id). This function take command_id as only variable, and return param in r3 for selected command. This is used widely to read command params, that include libcrypt commands. | |||
<div class="mw-collapsible mw-collapsed">'''Disassembly of the related function'''<pre class="mw-collapsible-content"> | <div class="mw-collapsible mw-collapsed">'''Disassembly of the related function'''<pre class="mw-collapsible-content"> | ||
Line 372: | Line 374: | ||
0x10C54 bne cr7, read_conf_loop | 0x10C54 bne cr7, read_conf_loop | ||
</pre></div> | </pre></div> | ||
Function mentioned above is placed on (in emu memory, 4.86): | |||
* ps1_emu 0x10638 | |||
* ps1_newemu 0x12F54 | |||
* ps1_netemu 0xB65F0 | |||
==== Game settings lists ==== | ==== Game settings lists ==== |
Revision as of 10:12, 3 February 2022
Description
Note: there are no PS1 emulators available in early Tool/DECR and Debug/DEX firmwares (does not have dev_flash/ps1emu or ps2emu folder. dev_flash/vsh/etc/version.txt & index.dat say: ¨ps1emu:NA@NA: ps2emu:NA@NA: ps2gxemu:NA@NA: emerald:NA@NA: bdp:NA@NA:¨).
- Firmware 1.02:
- Added ps1_emu.self
- Firmware 1.70:
- Added ps1_netemu.self
- Added the ability to play original PlayStation format games downloaded from the PlayStation Store.
- Added rumble functionality for USB accessories which support it when playing PS2 games.
- Saved data from PlayStation format software now usable on both PSP and PS3 systems.
- Backwards compatibility for PS1 and PS2 games was improved.
- Firmware 1.80:
- Ability to upscale PS1 and PS2 games
- Ability to copy PS1/PS2 game saves from PS3 to Memory Cards using a Memory Card adapter.
- Backwards compatibility for PS1 and PS2 games was improved.
- Firmware 2.10:
- Added ps1_newemu.self
- Added ps1_rom.bin (MD5: FBB5F59EC332451DEBCCF1E377017237)
- Users can now play PS1 game discs on a PSP with remote play, PSP firmware version 3.50 or newer is required. (this feature was not announced).
- Backwards compatibility for PS1 and PS2 games was improved (Update was also unannounced but evident in Sony's backwards compatibility search site).
- Firmware 4.00
- Updated ps1_rom.bin (MD5: 81BBE60BA7A3D1CEA1D48C14CBCC647B). The new rom is stripped from PS2 related functions. As a result is 3565296 bytes smaller than previous version.
Files
Emulator versions
There is no accurate info in wiki about the different PS1 emulator .self revisions, if you want to collaborate documenting this info see the experimental table on Discussion page
Game formats
See: ISO.BIN.EDAT and PSISOIMG0000
Savegames
- Location: /dev_hdd0/savedata/vmc
Note: capitalisation of filename is important: name it xxx.VM1 instead of xxxx.vm1 (e.g. Internal Memory Card.VM1 for PSX/PSone, Internal Memory Card.VM2 for PS2/PStwo)
The .VMx files appear to be raw memory card data:
- .VM1 Playstation 1 Memory cards can be edited with MemcardRex
- .VM2 Playstation 2 Memory cards can be edited with mymc
PS1 emulators workload comparison
All emulators seems to use similar workload. Note that SPU 0-4 don't use JOB name per se, so is just info what they do.
Core | Job | Source | Notes |
---|---|---|---|
SPU0 | PS1 GPU SLI0 | SPU ASM | PS1 GPU software emulation |
SPU1 | PS1 GPU SLI1 | SPU ASM | PS1 GPU software emulation |
SPU2 | PS1 GPU SLI2 | SPU ASM | PS1 GPU software emulation |
SPU3 | PS1 GPU SLI3 | SPU ASM | PS1 GPU software emulation |
SPU4 | PS1 SPU | SPU ASM | PS1 SPU software emulation |
SPU5 | _libadec_at3CellSpursKernel0 | SPU ASM | AT library from ps3 firmware |
SPU6 | Isolation | C++ Raw SPU | Not PS1 emu specific |
SPU7 | - | - | Unavailable: Factory disabled SPU |
PPU:0 | ? | ? | |
PPU:1 | ? | ? |
Core | Job | Source | Notes |
---|---|---|---|
SPU0 | PS1 GPU SLI0 | SPU ASM | PS1 GPU software emulation |
SPU1 | PS1 GPU SLI1 | SPU ASM | PS1 GPU software emulation |
SPU2 | PS1 GPU SLI2 | SPU ASM | PS1 GPU software emulation |
SPU3 | PS1 GPU SLI3 | SPU ASM | PS1 GPU software emulation |
SPU4 | PS1 SPU | SPU ASM | PS1 SPU software emulation |
SPU5 | _libadec_at3CellSpursKernel0 | SPU ASM | AT3 library from ps3 firmware |
SPU6 | Isolation | C++ Raw SPU | Not PS1 emu specific |
SPU7 | - | - | Unavailable: Factory disabled SPU |
PPU:0 | ? | ? | |
PPU:1 | ? | ? |
Core | Job | Source | Notes |
---|---|---|---|
SPU0 | PS1 GPU SLI0 | SPU ASM | PS1 GPU software emulation |
SPU1 | PS1 GPU SLI1 | SPU ASM | PS1 GPU software emulation |
SPU2 | PS1 GPU SLI2 | SPU ASM | PS1 GPU software emulation |
SPU3 | PS1 GPU SLI3 | SPU ASM | PS1 GPU software emulation |
SPU4 | PS1 SPU | SPU ASM | PS1 SPU software emulation |
SPU5 | _libadec_at3CellSpursKernel0 | SPU ASM | AT3 library from ps3 firmware |
SPU6 | Isolation | C++ Raw SPU | Not PS1 emu specific |
SPU7 | - | - | Unavailable: Factory disabled SPU |
PPU:0 | ? | ? | |
PPU:1 | ? | ? |
Arguments
ps1_emu.self
7 arguments | Name | Example | Notes |
---|---|---|---|
argv[0] | self starting location | dev_flash/ps1emu/ps1_emu.self | |
argv[1] | VM1-1 location | dev_hdd0/savedata/vmc/filename1.VM1 | |
argv[2] | VM1-2 location | dev_hdd0/savedata/vmc/filename2.VM1 | |
argv[3] | Regionnumber/TargetID | 0082 | |
argv[4] | unknown | 1200 | |
argv[5] | unknown | 1 | XRegistry.sys/setting/game/emuUpConvert ? (full/normal/off = 2/1/0) |
argv[6] | unknown | 0 | XRegistry.sys/setting/game/emuSmoothing ? (on/off = 1/0) |
ps1_netemu.self
9 arguments | Name | Example | Notes |
---|---|---|---|
argv[0] | Self starting location | dev_flash/ps1emu/ps1_netemu.self | |
argv[1] | VM1-1 name | (dev_hdd0/savedata/vmc/)argv[1] | |
argv[2] | VM1-2 name | (dev_hdd0/savedata/vmc/)argv[2] | |
argv[3] | Regionnumber/TargetID | 0084 | |
argv[4] | Unknown | 1200 | |
argv[5] | Path to ps1 game | /dev_hdd0/game/NPUJ01324 | |
argv[6] | Vibration on/off? | 1 | Seems to be XRegistry.sys/setting/pad/vibrationEnable |
argv[7] | Emu UpConvert | 0 | XRegistry.sys/setting/game/emuUpConvert ? (full/normal/off = 2/1/0) |
argv[8] | Emu Smoothing | 0 | XRegistry.sys/setting/game/emuSmoothing ? (on/off = 1/0) |
ps1_newemu.self
9 arguments | Name | Example | Notes |
---|---|---|---|
argv[0] | self starting location | dev_flash/ps1emu/ps1_newemu.self | |
argv[1] | VM1-1 name | (dev_hdd0/savedata/vmc/)argv[1] | |
argv[2] | VM1-2 name | (dev_hdd0/savedata/vmc/)argv[2] | |
argv[3] | Regionnumber/TargetID | 0082 | |
argv[4] | unknown | 600 | |
argv[5] | path to ps1 game | /dev_hdd0/game/NPUJ01324 | |
argv[6] | unknown | 1 | |
argv[7] | unknown | 2 | |
argv[8] | unknown | 2 |
PS1 GPU emulation
That part of all 3 emulators is quite impressive. Task is split between 4 SPE cores, but not in usual way. Every core is responsible for different part of PS1 GPU command flow, which is done dynamically. All that is linked by so called sli (spu link?), and all SPE cores run exactly same elf file. SPE program synchronize using sliTick, and sliTock functions with use of channels 16 - 24, and with help of PPU. That way 4 different PS1 GPU emulators can proceed 4 different PS1 GPU commands at the same time, with synchronization enough to not override other PS1 GPU tasks. As a example you can remove dithering by patch only on SPU0, and observe that only 1/4 of displayed lines will be missing dither pattern.
Game settings
External CONFIG file
Created/loaded by ps1_newemu.self and ps1_netemu.self at path: /USRDIR/CONFIG
Example:
00000000 1C 00 00 00 50 53 31 45 6D 75 43 6F 6E 66 69 67 ....PS1EmuConfig 00000010 46 69 6C 65 00 97 0A 54 04 00 00 00 01 00 00 00 File...T........ 00000020 0F D4 CC B9 10 00 00 00 64 69 73 63 5F 6E 6F 00 ........disc_no. 00000030 04 00 00 00 00 00 00 00 93 D1 5B F8 ..........[.
Offset | size | data | notes |
---|---|---|---|
0x00 | 0x04 | 1C 00 00 00 | size of the next 4 values |
0x04 | 0x10 | PS1EmuConfigFile | name/id |
0x14 | 0x04 | 00 97 0A 54 | ? |
0x18 | 0x04 | 04 00 00 00 | ? |
0x1C | 0x04 | 01 00 00 00 | ? |
0x20 | 0x04 | 0F D4 CC B9 | crc32 of the previous 4 values |
0x24 | 0x04 | 10 00 00 00 | size of the next 3 values |
0x28 | 0x08 | disc_no | name/id |
0x30 | 0x04 | 04 00 00 00 | amount of discs |
0x34 | 0x04 | 00 00 00 00 | disc number |
0x38 | 0x04 | 93 D1 5B F8 | crc32 of the previous 3 values |
- Other posible entries/commands/id
- user_memory_size ? (in both ps1_newemu.elf and ps1_netemu.elf appears next to PS1EmuConfigFile and disc_no)
Embedded Game settings
All the PS1 emulators contains a list of game settings embedded inside his .SELF structure inside 3 tables we could name the Checksums Table, the Title IDs table (is the only in human readable format), and the Commands Table. The offset of this tables differs by emulator revision and by emulator type
The entry point to read the whole structure of this tables starts by reading the 4 bytes of the first checksum from the checksums table (see below), next 4 bytes are an offset (to read the Title IDs table), next 4 bytes is a Command Count and next 4 bytes is a Command offset (to read the Commands Table), to load the data in the other tables is needed to substract 0x10000 to this offsets located next to the checksum of a specific game
Every command inside the Commands Table is composed by 8 bytes, where the first 4 bytes are the Command ID (see talk page) and the next 4 bytes is the Command Data
All the Command Data values can be considered the most bottom of this hierarchy... except command ID=0x02(netemu 3.40 up to 4.88) containing an offset to a deeper level of the hierarchy where is stored a list with some of the disc sectors for a few libcrypt protected games
Game checksum
Checksum is simple Adler32 calculated from 2048 bytes of disc data, starting from 0x9318 offset in raw image. Emulator perform check if that sector have CD001 string, if string is missing "unknown" string is used, and hash calculation is not performed. You can use tools like hashtab to easily calculate checksum for new game.
Is calculated using the data contents only (2048 bytes or 0x800h) of the sector 16 (beginning at the 0x9318 of the RAW/2352 image). Every single byte is used in the process. Calculation code does start at 0xC1658 in the ps1_netemu from 4.88 firmware.
Super simple python script to calculate checksum, script lack of some checks performed by emu, and is hardcoded to 0x9318 offset, but should be enough.
Usage: edit *your first.bin* to name of your image, run script from CMD. Require python (3?).

import zlib with open('your first.bin', 'rb') as f: f.seek(0x9318) suma = zlib.adler32(f.read(2048)) print (hex(suma))
Game settings access
Like mentioned above config is created from 2x u32 values. Lets call first value command, and second value param.
Command is used to calculate address for param, and only param is stored on obtained address.
Emulator then check for params, and if found (usually when not zero) apply settings based on them.
Beside functions that read command params directly, every emulator have function (madeup name) ReadInternalConfigValue(u32 command_id). This function take command_id as only variable, and return param in r3 for selected command. This is used widely to read command params, that include libcrypt commands.
Function mentioned above is placed on (in emu memory, 4.86):
- ps1_emu 0x10638
- ps1_newemu 0x12F54
- ps1_netemu 0xB65F0
Game settings lists
PS1 rom handling
Current version of ps1_rom file is first 512KB of 1.90 PS2 rom. Previously it was exactly the same version but whole 4MB were supplied to emulator.
Since firmware 2.10++ all PS1 emulators, ps1_emu.self, ps1_netemu.self, ps1_newemu.self uses the since then added ps1_rom.bin bios file. In earlier firmwares file was embed into every emulator self file. File ps1_rom.bin is exactly the same file that was previously embed in all PS1 emulators.
Firmware | Size | MD5 |
---|---|---|
2.10 ~ 3.74 | 4.089.584 | FBB5F59EC332451DEBCCF1E377017237 |
4.00 ~ 4.88 | 524.288 | 81BBE60BA7A3D1CEA1D48C14CBCC647B |
Region patch
All 3 emulators perform bios patching right after file is loaded into memory. Patch is related to region lock, and is unknown that its responsible for anything else, like timings etc.
There is a string in emulator JJJJAEJEAEJJEJJA which is selector for bios/rom region based on target ID (Product_Code).
J J J J A E J E A E J J E J J A 0x80 0x81 0x82 0x83 0x84 0x85 0x86 0x87 0x88 0x89 0x8A 0x8B 0x8C 0x8D 0x8E 0x8F
Patch apply to string in VERSTR, X is replaced with appropriate region:
System ROM Version 5.0 06/23/03 X Copyright 1993-1999 (C) Sony Computer Entertainment Inc.
Is worth to note that X is always on the same offset in ALL ps1 bios versions, and all ps2 bios images. So in case of bios swap
(Talk:PS1_Emulation#ps1_rom.bin ) correct region will be still set.
Patched offset is 0x7FF52 in rom file itself. Cobra have region free patch that in the end make X set to A (America) region, which apparently make bios region free. This can be true as similar thing happen on PCSX2 in ps1 mode. US rom is able to run all regions games, while JPN/EU fail to load different regions. It is because later JPN/EU BIOS versions have got an additional CD licence check introduced, accepting only the discs matching the hardcoded region. US BIOSes have never got this check implemented. By the way, it is the same thing with the PS2 BIOSes - only the US one will accept the discs from all over the world by default (that is why you have to patch the MECHACON for the US DTL region to get true region free playback).
PS1 games management in multiman
Manual starting SELF method
- Insert PSX/PSone disc (region/pressed doesn't matter)
- Start MultiMAN (e.g. 2.07.01++)
- Since 02.07.05 the PSX and PS2 discs are properly detected. PSX discs will show in XMB Game Column and you can launch the PS1 game from there. It uses ps1_emu.self default (you can choose Load or Load (Net), latter uses ps1_netemu).
- Switch to filemanager mode
- Browse to /dev_flash/ps1emu
- Select either one of the ps1 emulation SELF files
Note: Some games run better with ps1_emu.self (e.g. Mortal Kombat) while others run better with ps1_netemu.self (e.g. Resident Evil 3). If it doesn't work, try another ps1 emulation SELF file.
Downside: memory card options are unavailable unless you created a Virtual Memorycard before starting MultiMAN (XMB::Category Game:: Memory Card Utility (PS/PS2) > Create a PS1 memory card. Set it to Slot 1 (Press Triangle while selecting the Memory Card, then Assign it). Note: naming it "Internal Memory Card" sometimes works better than other names. MultiMAN 02.07.07 seems to solve the savegame issues.
Changes in MultiMAN 2.07.00/01 for ps1_emu handling
These options where needed to make above work:
- Added: LV2 access rights to use LV1 Storage Manager (syscall 864)
- Added: LV1 patch for user access to sys_storage functions (syscalls 600 to 623)
Arguments handling
From multiman.cpp source (line 2502) http://code.google.com/p/multiman/source/browse/source/multiman.cpp?r=8c5b662f1c54d4f95f646949cae3d033b15b1a2e
{ char* launchargv[9]; memset(launchargv, 0, sizeof(launchargv)); launchargv[0] = (char*)malloc(strlen(mc1)+1); strcpy(launchargv[0], mc1); launchargv[1] = (char*)malloc(strlen(mc2)+1); strcpy(launchargv[1], mc2); launchargv[2] = (char*)malloc( 5); strcpy(launchargv[2], "0082"); launchargv[3] = (char*)malloc( 5); strcpy(launchargv[3], "1600"); launchargv[4] = (char*)malloc(10); strcpy(launchargv[4], app_path); launchargv[5] = (char*)malloc( 2); strcpy(launchargv[5], "1"); launchargv[6] = (char*)malloc( 2); strcpy(launchargv[6], "2"); // full screen on/off = 2/1 launchargv[7] = (char*)malloc( 2); strcpy(launchargv[7], "1"); // smoothing on/off = 1/0 launchargv[8] = NULL; unload_modules(); exitspawn((const char*) "/dev_flash/ps1emu/ps1_netemu.self", (char* const*)launchargv, NULL, NULL, 0, 1001, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); } { char* launchargv[7]; memset(launchargv, 0, sizeof(launchargv)); launchargv[0] = (char*)malloc(strlen(mc1)+1); strcpy(launchargv[0], mc1); launchargv[1] = (char*)malloc(strlen(mc2)+1); strcpy(launchargv[1], mc2); launchargv[2] = (char*)malloc( 5); strcpy(launchargv[2], "0082"); // region launchargv[3] = (char*)malloc( 5); strcpy(launchargv[3], "1200"); launchargv[4] = (char*)malloc( 2); strcpy(launchargv[4], "1"); // full screen on/off = 2/1 launchargv[5] = (char*)malloc( 2); strcpy(launchargv[5], "1"); // smoothing on/off = 1/0 launchargv[6] = NULL; unload_modules(); exitspawn((const char*) "/dev_flash/ps1emu/ps1_emu.self", (char* const*)launchargv, NULL, NULL, 0, 1001, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); }
- Notes: