Git Product home page Git Product logo

Comments (17)

IntelOrca avatar IntelOrca commented on April 28, 2024

I am decompiling the game disassembly manually using IDA. The variable / method names are my own judgement at what the code is doing and also based on the OpenTTD 0.1 source code which is similar. The Roller Coaster Tycoon Techinical Information Depot has also been a useful resource.

The source compiles to a DLL. I patched the original game so that its entry point simply calls my DLL entry point instead. Code in the DLL then runs but is able to read/write to the original game's RAM and call methods. This means that the game can be gradually decompiled while still being playable. New features can also be implemented before the whole game has been decompiled.

The source code can only be compiled in Visual Studio due to the inline assembly used and also because RCT2 was compiled with an older version of Visual Studio. This will be the case until the whole game has been decompiled and running on SDL2 calls. Then it will be truly cross platform.

I will write up a manual on how to compile the game soon and how the new code is still able to call the original non-decompiled code.

To be able to help decompile the game, x86 assembly knowledge and reverse engineering experience is necessary.

Currently the game runs and renders in an SDL2 window which can be resized freely. The sound is still using DirectSound and the input is in the process of being decompiled. Many window functions have been decompiled now. Decompiling the code for all the windows in the game will be straight forward. Rendering of the viewports and game logic updating will be more complicated.

from openrct2.

kevinburke avatar kevinburke commented on April 28, 2024

Awesome! Wish I could help in some way; I've got limited experience with x86 to be honest (one compilers class).

Is there a way to estimate your progress on decompiling?

Also I tried the link on Tycoon Technical Depot but it's 404ing, http://www.gamespy.com/rctuk/tid/

from openrct2.

IntelOrca avatar IntelOrca commented on April 28, 2024

I have currently named / identified the function of ~25% of the procedures in rct2.exe. I have maybe decompiled around ~15%.

Try this backup:
http://web.archive.org/web/20131221171341/http://www.strategyplanet.com/rctuk/tid/

from openrct2.

UnknownShadow200 avatar UnknownShadow200 commented on April 28, 2024

I've created a copy of the pages from the Technical Depot which relate to technical information, which you can access here.

(slightly off topic, but the "Ride Structure" part of the sv4structs page may be helpful in finding the meaning of some of the unknown variables in ride.h)

Still though, excellent work so far with this project!

from openrct2.

IntelOrca avatar IntelOrca commented on April 28, 2024

Thanks for copying the pages, that is very useful.

The ride structure has changed slightly from RCT1 to RCT2, so each variable must be confirmed before assuming its the same. I am not sure how much it has changed or whether a lot of the variables have just been offset slightly. Its hard to tell at this stage.

from openrct2.

kevinburke avatar kevinburke commented on April 28, 2024

I've written a Go library to read ride formats into a Go struct. I've also
started adding the ride constants. https://github.com/kevinburke/rct-rides

Kevin Burke | Twilio
phone: 925.271.7005 | kev.inburke.com

On Thu, Apr 17, 2014 at 3:55 PM, UnknownShadow200
[email protected]:

I've created a copy of the pages from the Technical Depot which relate to
technical information, which you can access herehttps://github.com/UnknownShadow200/RCTTechDepot-Archive
.

(slightly off topic, but the "Ride Structure" part of the sv4structs page
may be helpful in finding the meaning of some of the unknown variables in
ride.h)

Still though, excellent work so far with this project!


Reply to this email directly or view it on GitHubhttps://github.com/IntelOrca/issues/1#issuecomment-40700628
.

from openrct2.

bvanheu avatar bvanheu commented on April 28, 2024

Which version of IDA are you using?

from openrct2.

IntelOrca avatar IntelOrca commented on April 28, 2024

IDA 5.0 freeware

from openrct2.

bvanheu avatar bvanheu commented on April 28, 2024

I don't have time to work on your project unfortunately :(

But I can decompile the whole thing with IDA 6.5 and hex-rays decompiler and provide C files.

Would that help you?

from openrct2.

IntelOrca avatar IntelOrca commented on April 28, 2024

I don't think the automatic decompiler would work very well due to the game being written in assembly and therefore not following typical compiler conventions. Thanks for the offer though.

from openrct2.

bvanheu avatar bvanheu commented on April 28, 2024

Good point! Good luck with your project!

from openrct2.

UnknownShadow200 avatar UnknownShadow200 commented on April 28, 2024

@IntelOrca
(apologies for going off-topic again)
How would you feel about OpenRCT2 being used to expand the RCT2 section of the Tech Depot Archive?

from openrct2.

RollingStar avatar RollingStar commented on April 28, 2024

@UnknownShadow200 Keep them separate. Make a new page, probably with a new name, with all of the new findings. If the code is well-commented, separate documentation may not even be all that necessary.

from openrct2.

IntelOrca avatar IntelOrca commented on April 28, 2024

@UnknownShadow200 that's fine

from openrct2.

bwrsandman avatar bwrsandman commented on April 28, 2024

I patched the original game so that its entry point simply calls my DLL entry point instead.

Could you provide more information on how this was done? Perhaps you wrote a script or you have designed a patch file.

I'd be interested in knowing how to reproduce those changes on the original rtc2.exe

from openrct2.

IntelOrca avatar IntelOrca commented on April 28, 2024

I used CFF Explorer to modify openrct2.exe so that it imported openrct2.dll and the exported new main function.

I then used IDA to find the address of the WinMain function in openrct2.exe and a hex editor to overwrite the instructions at that address to stack the WinMain parameters and call the exported function using the virtual address provided by CFF explorer for the new main function in the DLL.

from openrct2.

bwrsandman avatar bwrsandman commented on April 28, 2024

I followed your instructions, using Ollydbg instead of IDA and I was able to export WinMain into a dll and then call it afterward (with the help of adresses.h).
Thanks a lot to the tips!

from openrct2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.