News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: PS1 emulator that allows writes to a disc image?  (Read 904 times)

MysticLord

  • Jr. Member
  • **
  • Posts: 44
    • View Profile
PS1 emulator that allows writes to a disc image?
« on: September 13, 2020, 09:37:16 pm »
Someone brought up something in a chat where they were discussing a New Game Plus feature they wanted, but it's not possible because the game loads all character stats from one of four files at game scenario start. The only way I can think of saving stats, learned skills, equipped items, and so on would be to overwrite one or more of those files; or to create a new file, build a disc image around it, and write code so it's loaded instead of one of the normal files on starting a new game scenario when a post-game save is also present on the memory card.

Does this feature - the ability to write to files on a disc image - exist in any PS1 emulator?

[Unknown]

  • Jr. Member
  • **
  • Posts: 27
    • View Profile
    • PPSSPP
Re: PS1 emulator that allows writes to a disc image?
« Reply #1 on: September 13, 2020, 10:50:32 pm »
I don't think any PS1 emulators do that.

A typical way to implement this in a normal game would be a "clear flag".  It'd only need to be a single byte.

When they beat the game, you save a flag to the normal save data (memory card.)

Later, when the player loads that save data, you'd load the data as normal, but then when you see the clear flag, you'd redirect to the new game scenario code.  This would either skip ahead of the code that inits the stats, or set a clear flag in RAM somewhere so that code would skip it.

It might seem tempting to "overwrite the ISO" for this feature, but this isn't really compatible with multiple saves.  What if I want to create a new game without my clear data?  Or what if I'm playing the game two different ways simultaneously, for some reason?  Maybe after beating it, I want to try a "no level up" challenge, but later want to go back to my new game plus?

That's why it's better to handle it in the save data, if possible, because it already handles those scenarios.

-[Unknown]

Bregalad

  • Hero Member
  • *****
  • Posts: 2746
    • View Profile
Re: PS1 emulator that allows writes to a disc image?
« Reply #2 on: September 15, 2020, 04:49:40 am »
Why would any PS1 emulator allow to disc images ? The real console doesn't allow writing to the discs, and the goal of an emulator is to simulate the real thing.

Quote
It'd only need to be a single byte.
A single bit actually.

FAST6191

  • Hero Member
  • *****
  • Posts: 2896
    • View Profile
Re: PS1 emulator that allows writes to a disc image?
« Reply #3 on: September 15, 2020, 08:11:17 am »
Why would any PS1 emulator allow to disc images ? The real console doesn't allow writing to the discs, and the goal of an emulator is to simulate the real thing.
If the OP has come to us from seeing things like the 3ds and Switch wherein custom firmwares can be tasked with swapping out files of otherwise read only memory it is not unreasonable expect something similar be an option. Likewise there are those NES emulators that will save out various mods to graphics, and a handful of other emulators that will offer to hardpatch an IPS.

Now I would not expect it -- the list of iso formats for the PS1 makes that a nightmare even if ISO editing is your main focus in life, never mind as a throwaway function.

MysticLord

  • Jr. Member
  • **
  • Posts: 44
    • View Profile
Re: PS1 emulator that allows writes to a disc image?
« Reply #4 on: September 15, 2020, 10:33:34 pm »
I do not come from 3DS or Switch; I'm just curious, ignorant, and I have a +8 class bonus to recovering from social faux pas stemming from the former.

Unrelated Questions:

1. What emulators, if any, have support for better graphics? Do these emulators Just Work™, or do they require hacks for specific games?
2. Is it possible to modify PS1 games to take advantage of the improved specs of the PSP, or to work on PSP emulators and use the improved specs of PSP emulators?

[Unknown]

  • Jr. Member
  • **
  • Posts: 27
    • View Profile
    • PPSSPP
Re: PS1 emulator that allows writes to a disc image?
« Reply #5 on: September 16, 2020, 12:10:46 pm »
A single bit actually.

Sure, my mistake.  That might be easier to fit in indeed.

1. What emulators, if any, have support for better graphics? Do these emulators Just Work™, or do they require hacks for specific games?

A few emulators now have "PGXP" support, or perspective correction for texturing.  This one just works, as far as I know, in most games.

There's also texture replacement, which does not just work.  But it can improve graphics:
https://www.libretro.com/index.php/beetle-psx-hw-experimental-texture-replacement-now-available/

2. Is it possible to modify PS1 games to take advantage of the improved specs of the PSP, or to work on PSP emulators and use the improved specs of PSP emulators?

The custom PS1 emulator in the Sony PSP firmware doesn't really support any real enhancements, no.

As far as emulators, JPCSP has some support (no idea how far along) for running Sony's PSP emulator if you use its "BIOS files."  They would have the same functionality and I don't think JPCSP itself supports texture replacement.  I'm sure you're better off using a real PS1 emulator, rather than a PSP emulator emulating a PSP emulating a PS1.

PPSSPP on the other hand doesn't support the internal kernel things that Sony PS1 emulator requires, and we're not really interested in requiring "BIOS files" anyway.  Writing a new PS1 emulator from scratch seems less interesting than improving an existing open source PS1 emulator.

-[Unknown]

Jorpho

  • Hero Member
  • *****
  • Posts: 4538
  • The cat screams with the voice of a man.
    • View Profile
Re: PS1 emulator that allows writes to a disc image?
« Reply #6 on: September 16, 2020, 12:14:33 pm »
A few emulators now have "PGXP" support, or perspective correction for texturing.  This one just works, as far as I know, in most games.

There's also texture replacement, which does not just work.  But it can improve graphics:
https://www.libretro.com/index.php/beetle-psx-hw-experimental-texture-replacement-now-available/
Aside from textures, don't most emulators support rendering at higher resolutions?  I lost track of these things.  (Are plugins still a thing?)
This signature is an illusion and is a trap devised by Satan. Go ahead dauntlessly! Make rapid progres!

MysticLord

  • Jr. Member
  • **
  • Posts: 44
    • View Profile
Re: PS1 emulator that allows writes to a disc image?
« Reply #7 on: September 16, 2020, 04:56:13 pm »
I don't mean hooks in an emulator for injection of assets from outside the game; instead I mean changing a few lines of code (if it is that simple) in a PS1 emulator so it has 64 (or 128, or what have you) MB of RAM instead of 2 MB. Ditto with "improving" the other specs so long as the limitations of those specs aren't used by a game for (I guess) timing, or something important. Maybe more VRAM, a larger texture cache, support for resolutions higher than 640x480, more RAM for the SPU, disc images larger than 660 MB, support for Neil Corlett's ECMs...

I agree, it makes no sense to write a new PS1 emulator from scratch. If that's what I came across as asking about, I apologize. Instead, I'm wondering if and how one could make minimal modifications to existing PS1 emulators to capture low-hanging fruit IRT improved capabilities or performance, with no or minimal unwanted side effects.

If someone ever makes a handheld FPGA emulation device, such improvements to the base systems would be wonderful to have.

--------

As for the PSP, it's instruction set is a superset of the PS1. If you have a disassembly which can be reassembled 1 for 1 to make the PS1 executable files, wouldn't it just be a matter of changing I guess the BIOS-specific code/calls to match that of the PSP, then building a disc image which would work on a modded PSP or PSP emulator (and NOT by using the PS1 backwards compatability of those systems)?

I vaguely remember a project that did something similar with I think PowerPC hardware and either NES or SNES software.

--------

Unrelated, but if you want to avoid dealing with proprietary PS1 bios files (Yes, I do know you meant the PSP bios), this team is/was developing an open source PS1 bios:
https://github.com/grumpycoders/pcsx-redux/tree/main/src/mips/openbios

...as part of a project to improve and modernize PCSX:
https://github.com/grumpycoders/pcsx-redux

Quote
This is yet another fork of the Playstation Emulator, PCSX. While the work here is very much in progress, the goal is roughly the following:

  • Bring the codebase to more up to date code standards.
  • Get rid of the plugin system and create a single monolithic codebase that handles all aspects of the playstation emulation.
  • Write everything on top of SDL/OpenGL3+/ImGui for portability and readability.
  • Improve the debugging experience.
  • Improve the rendering experience.

Jorpho

  • Hero Member
  • *****
  • Posts: 4538
  • The cat screams with the voice of a man.
    • View Profile
Re: PS1 emulator that allows writes to a disc image?
« Reply #8 on: September 16, 2020, 08:22:06 pm »
I don't mean hooks in an emulator for injection of assets from outside the game; instead I mean changing a few lines of code (if it is that simple) in a PS1 emulator so it has 64 (or 128, or what have you) MB of RAM instead of 2 MB. Ditto with "improving" the other specs so long as the limitations of those specs aren't used by a game for (I guess) timing, or something important. Maybe more VRAM, a larger texture cache, support for resolutions higher than 640x480, more RAM for the SPU, disc images larger than 660 MB, support for Neil Corlett's ECMs...
A lot of those things wouldn't be useful unless you could extensively modify the programs as well to take advantage of the changes - much like having support for disc images larger than 660 MB wouldn't be useful unless you could reprogram a game to use more data somehow.

But higher resolutions are definitely a thing that's been done at some point – that's just a matter of changing the output of the emulated GPU.  Even old Bleem could do that, as can many emulators for other systems that do 3D.  In fact, isn't that what the PS1 emulator in the PS2 and PS3 already does?

Quote
As for the PSP, it's instruction set is a superset of the PS1. If you have a disassembly which can be reassembled 1 for 1 to make the PS1 executable files, wouldn't it just be a matter of changing I guess the BIOS-specific code/calls to match that of the PSP, then building a disc image which would work on a modded PSP or PSP emulator (and NOT by using the PS1 backwards compatability of those systems)?
But how would that be different from using the PS1 backwards compatibility?
This signature is an illusion and is a trap devised by Satan. Go ahead dauntlessly! Make rapid progres!

MysticLord

  • Jr. Member
  • **
  • Posts: 44
    • View Profile
Re: PS1 emulator that allows writes to a disc image?
« Reply #9 on: September 16, 2020, 10:50:06 pm »
A lot of those things wouldn't be useful unless you could extensively modify the programs as well to take advantage of the changes - much like having support for disc images larger than 660 MB wouldn't be useful unless you could reprogram a game to use more data somehow.

But higher resolutions are definitely a thing that's been done at some point – that's just a matter of changing the output of the emulated GPU.  Even old Bleem could do that, as can many emulators for other systems that do 3D.  In fact, isn't that what the PS1 emulator in the PS2 and PS3 already does?

I'm working on a game where the map/scripting system uses two bytes, but it only has 512 maps IIRC. Unless I'm mistaken, it could make up to 65,536 maps (with included scripting, sprites, animations) with no real issues. I have no idea what someone would do with the 2 years it would take to fully explore that, let alone the years it would take to make the maps, but it's doable.

Not all games have all their data stored in centralized, easy-to-edit tables (he groaned, scratching the keyboard indentations on his forehead).

Some of the graphical and possibly RAM changes would allow games like FF7 to use high-res models, maybe decrease draw distance on the world map, or make a larger world map.

But how would that be different from using the PS1 backwards compatibility?
I assume that PS1 games on the PSP can't access all the system resources of the PSP, and of course they can't use stuff like floating point registers which didn't exist on the PS1. Though I'm not an emu dev and am not qualified to know for sure.

Jorpho

  • Hero Member
  • *****
  • Posts: 4538
  • The cat screams with the voice of a man.
    • View Profile
Re: PS1 emulator that allows writes to a disc image?
« Reply #10 on: September 16, 2020, 11:35:28 pm »
Some of the graphical and possibly RAM changes would allow games like FF7 to use high-res models, maybe decrease draw distance on the world map, or make a larger world map.
Okay, but if it will only run on a rewritten emulator, and not on real PSX hardware, there's no reason not to just use "hooks for injection of assets from outside the game", as you put it.

Quote
I assume that PS1 games on the PSP can't access all the system resources of the PSP, and of course they can't use stuff like floating point registers which didn't exist on the PS1. Though I'm not an emu dev and am not qualified to know for sure.
Again, if there are system resources that can't be accessed through PS1 backwards compatibility, you'd have to make serious changes to the code before the game could use them.
This signature is an illusion and is a trap devised by Satan. Go ahead dauntlessly! Make rapid progres!

MysticLord

  • Jr. Member
  • **
  • Posts: 44
    • View Profile
Re: PS1 emulator that allows writes to a disc image?
« Reply #11 on: September 17, 2020, 12:24:16 am »
Okay, but if it will only run on a rewritten emulator, and not on real PSX hardware, there's no reason not to just use "hooks for injection of assets from outside the game", as you put it.
Hooks for stuff like expansion of data tables need to be customized for each game.

Again, if there are system resources that can't be accessed through PS1 backwards compatibility, you'd have to make serious changes to the code before the game could use them.
Some games are already so well documented that they could be ported to PSP. FFT in particular is very well documented, just needs someone to get all the commented disassemblies on their wiki into shape. It's on my to-do list once I'm done with my current game.

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 7003
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: PS1 emulator that allows writes to a disc image?
« Reply #12 on: September 17, 2020, 01:07:45 am »
Rewriting to ISOs would be a feature outside of a real PS1 because real PS1s used CD-ROM drives, not CD-R/RW/whatever.

Put that in an emulator and you're basically now emulating a fantasy PS1-based console rather than an actual PS1.
"My watch says 30 chickens" Google, 2018

[Unknown]

  • Jr. Member
  • **
  • Posts: 27
    • View Profile
    • PPSSPP
Re: PS1 emulator that allows writes to a disc image?
« Reply #13 on: September 17, 2020, 03:15:38 am »
As for the PSP, it's instruction set is a superset of the PS1.

Well, the PS1 has a coprocessor called the GTE which behaves entirely differently from the VFPU coprocessor in the PSP.  Although the MIPS CPU instructions are a strict superset, it is not true that you can just run any PS1 MIPS code directly on a PSP - you'd need to rewrite COP2 and memory addressing at least.

Also, games in that era were free to modify their own code for speed, and sometimes did.  That's not to say the shared MIPS doesn't make it easier, but it's not 1 for 1 - the generated PSP code would not just swap out instructions, it might be larger or smaller.

I don't think there's anything wrong with the idea of an emulator that allows emulating an unrealistic version of a console for hacking - to me an emulator is, in many ways, an alternative to the original hardware.  I can play Final Fantasy 7 on a PSX, or in a PS1 emulator.  The emulator gives me additional features already.

If Sony turned around and released a "New Sony PSX Lite" with extra RAM and VRAM, certainly no one would complain about an emulator having the same features, or about hacks to existing PS1 games to leverage the improved hardware.

I mean, PPSSPP now allows you to set the RAM size above even the size given on even the devkit, and I think maybe the official Sony PSP emulator for the PS3 also supported that, for exactly the reasons of enhancements (see the "HD" PSP ports for the PS3.)  Emulating a fantasy console isn't by definition wrong.

-[Unknown]

Jorpho

  • Hero Member
  • *****
  • Posts: 4538
  • The cat screams with the voice of a man.
    • View Profile
Re: PS1 emulator that allows writes to a disc image?
« Reply #14 on: September 17, 2020, 11:51:35 am »
Another good example would be the "Giga drive" that M2 imagined when making the 3DS Genesis ports.
https://www.siliconera.com/emulating-megadrive-3ds-isnt-easy-enter-3d-sonic-hedgehog/

Or for that matter there's that new 3DSEN emulator, which looks very pretty until you realize that the author just deliberately re-drew a bunch of the sprites for a very particular selection of games, and it doesn't do much for games outside the selection.
https://www.youtube.com/watch?v=x8S59Tu08Xw

Hooks for stuff like expansion of data tables need to be customized for each game.
My point is that even if you did something to the emulated hardware, you would still have to make custom hacks for each game for "expansion of data tables". And that there's not much you could do that would make generating those custom hacks much easier.

If Sony turned around and released a "New Sony PSX Lite" with extra RAM and VRAM, certainly no one would complain about an emulator having the same features, or about hacks to existing PS1 games to leverage the improved hardware.
No? Surely you would expect there to be people complaining, "Why don't the magical Internet elves hack my favorite game? Someone did this one thing so it should be easy to do this other completely different thing, and also I want it for free and I don't want to learn how to do it myself."

And I recall there were definitely people complaining when people released those Chrono Trigger music hacks for ZSNES instead of using the MSU-1 interface.  But that is probably a different matter.
« Last Edit: September 17, 2020, 12:32:44 pm by Jorpho »
This signature is an illusion and is a trap devised by Satan. Go ahead dauntlessly! Make rapid progres!

MysticLord

  • Jr. Member
  • **
  • Posts: 44
    • View Profile
Re: PS1 emulator that allows writes to a disc image?
« Reply #15 on: September 17, 2020, 12:59:51 pm »
To go back to an earlier fork in the conversation, how easy is it to modify an existing emulator to create more resources such as additional RAM for games running on the emulator (insert download more RAM jokes here)?

Is it a simple grep command on the codebase followed by some tinkering, or does it require more skill than that possessed by a codemonkey such as myself? How much does it vary depending on the emulator and the quality of it's code?

What classes of resource "improvements" would let existing games run just fine, and which would cause problems?

I'm not as interested in reasons why or why not it's a good idea as much as the feasibility of it.

FAST6191

  • Hero Member
  • *****
  • Posts: 2896
    • View Profile
Re: PS1 emulator that allows writes to a disc image?
« Reply #16 on: September 17, 2020, 06:39:22 pm »
Will likely depend upon the system and the emulator itself.
Some systems the general memory map/bus layout will have gaps in it you can bump things up into (some flash carts and expansion chips going there, or it being that for debug versions of a console), or other gaps later on you could similarly use. Indeed if an emulator out there has a switch that can allow appearing as a debug version of a console (which most of the time will have extra memory over retail) then having a gander at its source code might be the way to go there to get an idea of what you might want to do.

Others will have the code more tightly wound together will all sorts of relative jumps with the emulators' conception of memory/own program memory that you might mess up by inserting a bunch of bytes in middle of it.

Making the games make use of the extra is a whole different kettle of fish. Maybe some of the later systems with dynamic memory could have something done almost automatically. Earlier stuff and things with static compilation will ignore it all day long. If you need the extra space to doodle in for your own purposes when playing hacker then OK (though it had better be some horribly latency sensitive affair else most will ask why that and not some kind of accessory lua script http://www.romhacking.net/forum/index.php?topic=18717.0 ).

Also while you said reasons why it is not a good idea is not of interest I will note that most places won't accept this sort of thing -- around here runs on hardware is the main goal, even those places like the N64 high res texture peeps that colour way outside the lines will probably not care for it, tool assisted speedrun might not do much...

As far as improvements in general. There are all sorts of things you could look into.
Motion interpolation for 3d, as well as some kind of fun with subsurf, the usual (or at least those that play with PS1 3d) 3d improvements, maybe something with controls (don't know how much the "better latency than perfect hardware" some stuff we have been seeing for older devices will do here), if there is plausibly an option to boost read times then that (trip flags immediately when you have the data available, mainly because your hard drive is likely faster than a 2x CDROM drive).