Skip to content

Instantly share code, notes, and snippets.

@nmlgc
Created June 27, 2014 17:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nmlgc/cc7d5b7667c35dda778e to your computer and use it in GitHub Desktop.
Save nmlgc/cc7d5b7667c35dda778e to your computer and use it in GitHub Desktop.
[01:14:14] Nmlgc: Fuck sleep. I have made a decision.
[01:14:57] Nmlgc: Nazeo, remember November 2012? When I first started work on PC-98, and tried to port the code to modern systems?
[01:15:17] Nmlgc: I am going to complete this project.
[01:16:52] BurntToast12: Are You Sure About This?
[01:16:54] Nmlgc: First, I am going to reassemble the original game back into compilable C++ code and thus open it up.
[01:17:03] BurntToast12: You Shouldn't Push Yourself Too Hard.
[01:17:45] Nmlgc: The disassembly has progressed up to a point where this is pretty much easy and enjoyable grunt work.
[01:17:58] BurntToast12: Hmm..
[01:19:56] Nmlgc: From that point on, we're going to reprogram the games themselves into a truly moddable form, all while keeping the original PC-98 flavor and spirit.
[01:20:28] BurntToast12: Wait, When Modding Pc-98, Does It Have Special Requirements?
[01:21:16] Nmlgc: The games will work on modern systems; no need for emulators or anything.
[01:21:36] Nmlgc: No need to use thcrap in any of this.
[01:21:43] BurntToast12: o:
[01:22:13] BurntToast12: What I Meant Was Is There Any Restrictions? Like Colour Bits And Such
[01:22:27] Nmlgc: Anything is possible.
[01:22:31] BurntToast12: Ah.
[01:22:41] Nmlgc: As soon as the first step is complete, *we* are the ones making the rules!
[01:24:06] Nmlgc: And since I will provide proof that the code is 100% authentic, we're going to get *all* the credibility. This ain't gonna be your lousy Danmakufu remake.
[01:24:25] BurntToast12: o:
[01:24:35] BurntToast12: Can We Change Sprite Boundaries And Such?
[01:24:53] Nmlgc: We will have the code.
[01:25:08] Nmlgc: It's just a matter of programming it in.
[01:25:24] BurntToast12: Mm...
[01:25:25] Nmlgc: There will be forks, lots of them.
[01:28:06] BurntToast12: Is This Going To Be Hard? '3'
[01:28:17] Nmlgc: [01:17] Nmlgc: The disassembly has progressed up to a point where this is pretty much easy and enjoyable grunt work.
[01:28:32] Nmlgc: It'll take long, that's for sure.
[01:28:37] BurntToast12: I Meant The Programming In
[01:28:58] Nmlgc: Honestly, I can't tell right now.
[01:29:33] BurntToast12: Let's Just Hope That It Doesn't Have Bad Coding.
[01:30:38] Nmlgc: [01:16] Nmlgc: The bad coding isn't touched in this step - which is important to ensure the credibility of the whole process.
[01:31:02] BurntToast12: Ah.
[01:31:02] Nmlgc: But then, we have the source code, and can reprogram any bad coding as we wish.
[01:32:01] Nmlgc: Look: https://dl.dropboxusercontent.com/u/13801415/Touhou/mi/pc98/th05_op.idb.20140625.png
[01:32:19] Nmlgc: This shows the state of disassembly on th05's main menu.
[01:32:42] Nmlgc: The light blue areas are code from the engines ZUN used - meaning, ZUN did not write this code.
[01:33:06] Nmlgc: We already have the source code for all of these.
[01:33:18] BurntToast12: Mm...
[01:33:36] Nmlgc: The dark blue areas are the actual code written by ZUN. These are the tricky parts.
[01:41:05] Nmlgc: (Oh, and it also includes the sound drivers, which I haven't looked at yet.)
[01:34:40] Nmlgc: The gray areas are data.
[01:34:53] BurntToast12: Like The Sprites And Musics?
[01:34:58] Nmlgc: Menu strings, etc.
[01:35:12] Nmlgc: Just shows how much stuff is hardcoded in these games...
[01:35:24] BurntToast12: Mm....
[01:37:00] Nmlgc: The rest is stuff that most likely doesn't matter.
[02:30:54] Nazeo Aelko Nezen: Back-
[02:30:57] Nazeo Aelko Nezen: I do remember this
[02:31:35] Nazeo Aelko Nezen: This is exciting...!
[02:34:42] Nazeo Aelko Nezen: Source code is a lot of power owo
[07:47:01] Nmlgc: Right? I mean, this changes everything.
[07:49:59] Nmlgc: I can now let xJeePx release whatever kind of English patch he pleases and have the piracy groups distribute whatever version. With the source code aeventually vailable to everyone, there is no need to preserve ZUN's original build.
[07:50:49] Nmlgc: And once there is a legit port of the game that doesn't require people to deal with emulators, everyone will flock to that. :)
[07:51:12] Nazeo Aelko Nezen: As for us?
[07:51:47] Nmlgc: We don't have to bother with porting thcrap to PC-98.
[07:51:56] Nazeo Aelko Nezen: Mm...
[07:52:04] Nmlgc: Too bad this hits me now, just as I invested half a week into getting it to work. :/
[07:52:24] Nazeo Aelko Nezen: Least you now know!
[07:53:37] Nmlgc: OK, good, there might still be a few things which would make this difficult...
[07:53:50] Nmlgc: Namely, in the area of porting these games to modern systems.
[07:54:40] Nmlgc: Even though we have the source code, it will still be strongly tied to the PC-98 architecture.
[07:56:04] Nazeo Aelko Nezen: You can re-write that though, yes?
[07:56:13] Nazeo Aelko Nezen: You won't have to start from the ground up anymore
[07:56:47] Nmlgc: Yeah, pretty much. This will be an iterative process.
[07:57:50] Nmlgc: First, we make sure that the source code matches, and that it can compile back to a PC-98 application that behaves identical to ZUN's original ones.
[07:59:14] Nmlgc: Then, we'll annotate more and more of the assembly dump in order to make it all understandable and extensible.
[08:01:23] Nazeo Aelko Nezen: Got your favorite drink by you?
[08:01:27] Nazeo Aelko Nezen: It might be a long one
[08:01:36] Nmlgc: Yeah.
[08:02:04] Nmlgc: But hey, I've already reduced the theoretical workload of such an effort by some 70%. :)
[08:03:56] Nazeo Aelko Nezen: Yay~
[08:19:02] Nmlgc: Now, Step 2 will be the biggest challenge here - porting all this code to modern systems.
[08:19:32] Nmlgc: A big chunk of the light blue stuff is the C++ runtime library. That's totally a non-issue.
[08:20:20] Nmlgc: However, we do need to translate master.lib from 16-bit assembly to portable C code.
[08:24:42] Nmlgc: And I need to hook it up to a cross-platform graphics engine.
[08:26:03] Nmlgc: I'll probably just adopt what PyTouhou does. They're focusing on portability, after all. ^^
[08:40:30] Nmlgc: (I just hope I'm aware of what I'm getting myself into...)
[08:40:35] BurntToast12: Can We Do This On The Modern Games?
[09:44:05] Nmlgc: Nope. They have a lot more code, and I don't know of any source code to the individual engines and libraries used in the Windows Touhou games.
[09:44:43] Nmlgc: However, PyTouhou is already doing something similar, albeit from a different angle.
[09:45:33] Nmlgc: And our reverse-engineering project won't really be compatible with them, since they take legal matters very seriously.
[09:45:47] BurntToast12: Huh.
[09:46:16] Nazeo Aelko Nezen: Their legal approach means it's harder for them, yes?
[09:46:39] Nmlgc: Not necessarily.
[09:49:01] Nmlgc: As I said, the amount of code in the Windows games would make our approach highly impractical anyway. Attacking this problem from a different angle is pretty much the only way they could have ever succeeded.
[09:50:30] Nmlgc: The legal aspects are just a nice bonus that enables them to spread their work in the Linux community.
[09:56:34] Nazeo Aelko Nezen: Ah, I see
[10:13:30] Nmlgc: So, as for the feasibility of the PC-98 project.
[10:14:32] Nmlgc: Theoretically, we can call it a day as soon as we have the source code. This alone means that we have done enough good.
[10:15:26] Nmlgc: Since the games are open-sourced then, anyone could - and should - take it over from there.
[10:16:13] Nmlgc: If we fail to do the port, that's fine!
[10:16:47] Nmlgc: We can just stay on PC-98, and extend the games while still requiring a PC-98, real or emulated.
[10:16:59] Nazeo Aelko Nezen: Would your methods change?
[10:17:35] Nmlgc: Well, we'd still be independent of the core thcrap engine.
[10:43:47] Nmlgc: I'll be spending today with doing a test run of all this. IDA has a nice function that will generate an assembly source file out of a database. If I manage to recompile this today, I'll greenlight the project.
[10:44:05] Nazeo Aelko Nezen: Good luck~
[12:44:24] Nmlgc: Hm, we need a snappy name for this undertaking.
[12:44:32] Nmlgc: How about "ReC98"? Nice pun.
[12:44:48] Nazeo Aelko Nezen: I'm down with it c:
[22:18:19] Nmlgc: Success!
[22:19:35] Nmlgc: I successfully de- and recompiled th05's OP.EXE. ReC98 is officially greenlit~
[22:50:02] Nmlgc: OK, relaying the news to xJeePx now
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment