openrct2 / openrct2 Goto Github PK
View Code? Open in Web Editor NEWAn open source re-implementation of RollerCoaster Tycoon 2 đ˘
Home Page: https://openrct2.io
License: GNU General Public License v3.0
An open source re-implementation of RollerCoaster Tycoon 2 đ˘
Home Page: https://openrct2.io
License: GNU General Public License v3.0
I'm using i586-mingw32-gcc to compile the game and it doesn't like last night's change to window_options.c
/Users/kevin/code/OpenRCT2/src/window_options.c: In function âwindow_options_mousedownâ:
/Users/kevin/code/OpenRCT2/src/window_options.c:312:45: error: âintptr_tâ undeclared (first use in this function)
gDropdownItemsArgs[i] = 1170 | ((uint64)(intptr_t)gAudioDevices[i].name << 16);
^
/Users/kevin/code/OpenRCT2/src/window_options.c:312:45: note: each undeclared identifier is reported only once for each function it appears in
/Users/kevin/code/OpenRCT2/src/window_options.c:312:54: error: expected â)â before âgAudioDevicesâ
gDropdownItemsArgs[i] = 1170 | ((uint64)(intptr_t)gAudioDevices[i].name << 16);
Let me know if there's a good workaround or fix here.
Hi IntelOrca,
I have limited experience with reverse engineering (used to write "trainers" for games, reverse-engineer game file formats etc.) and would like to help working on this project.
I was wondering whether it would be a good idea to set up an IRC channel somewhere so that certain aspects of the game/project could be discussed? It could also be useful to set up a wiki to document findings.
I expect that a function named update_ride_measurements
would be called when I build a roller coaster, place it in "test" mode, and wait for ride excitement etc. to come in.
However, when I decompiled that function to C, and placed a debug statement inside the update_ride_measurements
function, I saw that the code was breaking every time here: kevinburke/OpenRCT2@IntelOrca:master...update-ride-measurements#diff-9c6869fd8d2a66b193a9b7913b99bdfaR164, and never going beyond that statement.
Now, it is possible I have written the code poorly and it's not doing what I expect. But when I run the game, I get test results that seem accurate, so it seems like storing test results is not dependent on the function currently named update_ride_measurements
.
From rct2.c:
#define GAME_PATH "C:\\Program Files (x86)\\Infogrames\\RollerCoaster Tycoon 2"
Only ever called in one other spot, in the same file:
void rct2_init_directories()
{
strcpy(RCT2_ADDRESS(RCT2_ADDRESS_APP_PATH, char), GAME_PATH);
It then sets up other addresses (like the "tracks" folder) from this.
My question is whether the original RCT2 executable does this. Either way, what's the point of this? It looks like it's hardcoded, but I thought the real RCT2 loads this directory information from the Windows registry?
I am watching this repository and would be happy to label issues as questions, bugs, or any of the other options.
Github requires full access to the repository to have permission to apply labels to issues, which I think is unfortunate.
If you did add me for this purpose, I would not ever push commits to the repository. I'd continue submitting occasional pull requests whenever I could clean up comments or the readme. As far as I can tell, Git / GitHub has full rollback support, so if I turned evil on you it would be simple to revoke my access and repair any damage.
I assume that it's too early -- too much is being changed too rapidly for bug reports to be valuable at this stage. Still, I leave it to you, IntelOrca.
Great project! I've been hoping for years that something like OpenTTD would get off the ground for RCT. I wish you the best of luck. I loaded the project and played around a bit but I found a bug. I don't know if you're aware but some scenarios (beginner parks > the first 8, dark age until south america) throw an exception. Crazy Castle and others seem to load fine.
It crashes when RCT2_CALLPROC_EBPSAFE(0x00684AC3); in scenario.c is called.
Consider this a heads-up and my humble attempt to help out. My reverse engineering skills are non-existing but I'll certainly follow the project.
Occasionally, I'd like to inspect the contents of memory with printf() but the problem is if you do this from a function that gets called every tick, the console will get flooded with messages.
Would be nice if there was a button in the toolbar, which when clicked in the game, ran a debug/printf function, which you could be ignored with git update-index --skip-worktree and then filled however you liked/based on whatever you were working on.
Finished creating a build server for this project. Every 10 minutes it checks for a new commit and then builds a download. Downloads are placed on this page: https://openrct2.com/download
I am aware that it doesn't serve much use yet.
Planned features:
Thoughts? :)
I can't reproduce it every time. All I'm doing is going to a park, change the information window tab to pricing or statistics tab and mouse over some options to display their tooltips. (By the way, should the tooltips always show up immediately? I had to wait a few seconds in the original)
Normal state:
After mousing over anything that shows a tooltip:
Options menu with glitches
Where did you get the files from? Are you generating the variable/method names or are they coming from the source code?
How would I build this myself? What platforms are supported?
When attempting to compile in VS2013, I get the following errors:
error C4703: potentially uninitialized pointer variable `widget` used on line 526 of game.c
error C4703: potentially uninitialized pointer variable `widget` used on line 647 of game.c
I am confused because the game reported a successful compile on openrct2.com/download. Does everyone else use "Build" with less restrictive settings? I just used whatever the default was for VS2013.
You guys might want to note that stating OpenTTD is reverse-engineered is a statement only 1 person actually knows. to my knowledge not even the core developers of OpenTTD know where it came from, as it used to be a one-man project, and the original dev has long since gone.
steps to reproduce:
how well does the ride structure in rct2 match up to the data in tycoon technical depot? seeing this bit check for a giga coaster:
.text:006C5275 check_cable_lift_hill: ; CODE XREF: sub_6C511D+146�j
.text:006C5275 01C cmp bp, 7Bh ; '{'
.text:006C5279 01C jnz short loc_6C528B
.text:006C527B 01C test dword ptr [esi+1D0h], 10000h
.text:006C5285 01C jnz one_cable_lift_per_ride
which would seem to check the 17th bit of 1D0 of the ride for a cable lift. I know this is the right place because the on ride photo check is in the 5th bit, same as the data in "Ride Structure", seems to match up with these bits from "Ride Structure" in technical depot:
002,3 : bit 0 = train(s) on track, bit 1 = tested; bit 2 = test in progress; bit 3 = don't show raw stats; bit 4 = pass through station without stopping; bit 5 = On-Ride photo; bit 6 = ?; bit 7 = broken down; bit 10 = crashed; bit 12 = ever been opened; bit 13 = play music; bit 14 = construction/demolition prohibited (indestructible ride); bit 15 = demolition prohibited (used when there are indestructible track pieces)
so maybe they moved all that data to 1D0 because they needed more bytes. here's the code for on ride photo
.text:006C525F check_on_ride_photo: ; CODE XREF: sub_6C511D+135�j
.text:006C525F 01C cmp bp, 72h ; 'r'
.text:006C5263 01C jnz short check_cable_lift_hill
.text:006C5265 01C test dword ptr [esi+1D0h], 20h
.text:006C526F 01C jnz one_on_ride_photo
either way, would be good to start putting together a wiki (or using the IDC file) to document this sort of thing.
Is there a better way? I had to add all of these paths to the relevant include, lib, bin path for the project, to pick up files like rc.exe, winmm.lib, and shlobj.h.
If you don't have this path in your vcxproj, how did you include those files in your project?
I have an idling build server sitting around that I've been meaning to play around with. Once I am a little less busy with school and work I'll get it going on this. The project is super awesome so far.
It should be possible to make it easier to supply the location of the original RCT2.exe file. It would be better to either read from registry or reading from a config file.
I'm willing to implement if it is a desired function we want:)
first bit of 9DEA6E tells you whether the game is paused (1 is paused).
you can check this by looking at address 0x6c520b, which errors if you try to build track when the game's paused.
in addition subroutine 667c15 seems to toggle pause on/off.
Steps to reproduce are here: https://github.com/IntelOrca/OpenRCT2/wiki/Building-OpenRCT2-on-non-Windows-machines
I'm trying to get started but this is kind of a big blocker.
An example error is a syntax error, "." on line 162 of climate.c.
I am using the vanilla VS2012 settings with no changes. Are there really this many syntax errors or am I not using the correct compiler or something?
Where is it and how can I go about fixing it?
Steps:
First-chance exception at 0x006E3877 in openrct2.exe: 0xC0000005: Access violation reading location 0x00000000.
Unhandled exception at 0x006E3877 in openrct2.exe: 0xC0000005: Access violation reading location 0x00000000.
I am on the release build and I did rebuild solutions, suggestions?
When I try to load a scenario, I get "Access violation" and a message that the game is attempting to read memory location 0x00000 or 0x000007 or some such.
Stack trace goes from line 303 of RCT2_CALLPROC_EBPSAFE to line 229 of scenario_load_and_play (0x00684AC3) to window_title_scenarioselect.c.
Not quite sure what's going on, but when I try building the app with Windows 7/VS2013 Express Desktop/SDL 2.0.3, I get an error where sdl_platform.h tries to include winapifamily.h and fails.
I found this patch, http://www.marshut.com/irzuki/sdl-platform-h.html, applied it, and still get the same error.
What is the difference between these functions? What patterns in IDA should we look out for to let us know when to use each of these functions?
1.The money display in lower left doesn't update when necessary
2.Buying/selling breaks after launching the second park
First he had a problem with installing cmake and wine because he had earlier, unlinked versions of those dependencies installed.
He got the following errors, from top to bottom:
https://gist.github.com/kyleconroy/1328b26711650f25619e
At some point we ran bash clean.sh
and reran build.sh
which got to the OpenRCT2 print screen at least, but he never got it to run.
If you are on the home screen and click "Load Game", you are asked if you would like to save your game, which seems not right.
When building the project and launching it the first time, it gets the warning window to show data files of RCT2 installation, as expected, but instead of showing directory browser it gets this error:
And then the executable crashes trying to access the wrong address. Here's the exception VS gets:
Building on Windows 7 x86, VS 2013 Ultimate
First off, excellent work!
Is there a chance there will be cross platform build scripts / Make files, or is there a simple way to compile the Visual Studio project on other platforms?
At line 0x006B64C0 there's this set of instructions:
shl esi, 8
add esi, offset sprites
where sprites
is the address at 0x10E63BC.
How does this translate into C code? How is the offset being selected? I'll add it to the wiki.
It appears the movement of the camera is bugged. When you "right click" to move around the park, it keeps moving you even if you dont move the mouse but hold the right click, and moving around, isn't smooth, it seems to get stuck and slows down like there's added friction.
Another thing I noticed, was the Cursor. the pointer is no longer being used, when you hover over rides or peeps, its just normal cursor default and not the pointer (the pointer tells the user that area is clickable)
Starting at address 0x00597c9d (or 0x00997c9d, I am not sure why the difference is there, but my Go program had to read the data from 0x005..), there are a bunch of track piece properties. For each track piece listed here: https://github.com/UnknownShadow200/RCTTechDepot-Archive/blob/master/trackelements.html
there's an 8 byte long struct containing more information about the track piece.
// byte 0:
// value 2: end station
// value 7: vertical loop
// value 13: s bend
// 17: twist
// 18: half loop
// 19: corkscrew
// 20: tower base
// 21: small helix
// 22: large helix
// 23: unbanked large helix
// 24: brakes
// 26: on ride photo
// 27: water splash
// 29: barrel roll
// 30: powered lift
// 31: half loop
// 33: log flume reverser
// 36: whoa belly
// 43: lift hill
// 46: spinning tunnel
// 47: rotation control toggle
// 52: rapids (rct2 only)
// 152: waterfall/whirlpool
// 172: brake for drop
// byte 1:
// 2: ends at 25 degree up
// 4: ends at 60 degree up
// 6: ends at 25 degree down
// 8: ends at 60 degree down
// 10: 90 degree up (tower, whoa belly)
// 18: 90 degree down
// byte 2:
// 2: starts at 25 degree up
// 4: starts at 60 degree up
// 6: starts at 25 degree down
// 8: starts at 60 degree down
// 10: 90 degree up (also tower, whoa belly)
// 18: 90 degree down
// byte 3:
// 2: ends with left bank
// 4: ends with right bank
// 15: ends upside down
// byte 4:
// 2: starts with L bank
// 4: starts with R bank
// 15: starts upside down
// byte 5:
// 64: half loop up
// 192: half loop down
// 208: something relating to vertical loops. same for both L and R
// 224: corkscrew down
As far as I can tell, bytes 6 and 7 are always empty.
The 2nd address listed, track_config_table_2
, seems to be for RCT1 and has missing data in some places - for example 0x73, ELEM_25_DEG_DOWN_LEFT_BANKED, has data in track_config_table_1 but not in #2.
I have this data/parser in a file, here: https://gist.github.com/kevinburke/11188314
I think there is more data to be found in the binary somewhere. For example, this has no flags for diagonal pieces, no data about direction changes (for turns), and no data about the diameter of a turn.
Happy to add this to the project, but curious about the best way to represent the struct and the constants in it.
src/audio.h
mentions dsound.h
, which is missing on my machine.
Where can I get this file? where should I place it?
I believe 0x97CF40 onward are bit flags relating to various rides in the game. They seem to be compared against 0x2000h or similar fairly often, and the numbers are similar for similar types of rides.
I haven't actually figured out what these mean but you might wanna update the file/IDC database.
Spiral Roller coaster 183 70 16 220 10 27 30 17
Stand Up Coaster 183 70 16 220 7 27 0 0
Suspended Swinging 183 70 16 220 0 0 0 0
Inverted 183 70 16 220 7 27 0 0
Steel Mini Coaster 183 70 16 220 0 0 0 0
Mini Railroad 20 66 0 212 0 0 0 0
Monorail 23 66 0 212 0 0 0 0
Mini Suspended Coaster 181 70 16 220 0 0 0 0
Bumper Boats 69 72 0 156 0 0 0 0
Wooden Wild Mine/Mouse 181 70 16 156 0 0 0 0
Steeplechase/Motorbike/Soap Box Derby 183 70 16 220 0 0 0 0
Car Ride 39 66 16 148 0 0 0 0
Launched Freefall 15 67 20 148 10 40 0 0
location 0x006c53a3 deals with computing the new track height.
0x006c59F1 sets up the "Too low!" error message. 0x36D corresponds to the string ID for "Too low!"
0x006c59FC sets up "Too high"
What is the best way to add print statements and get them to display in Visual Studio? For when you don't necessarily want to set a breakpoint, but do want to inspect some values. Let me know and I'll add it to the wiki.
error C2061: syntax error: identifier 'abs;
that among all the other "using"
What are these and how do I go about fixing it?
When building master, travis-ci reports:
/home/travis/build/kevinburke/OpenRCT2/src/sawyercoding.c: In function âsawyercoding_read_chunkâ:
/home/travis/build/kevinburke/OpenRCT2/src/sawyercoding.c:81:3: error: expected expression before â)â token
/home/travis/build/kevinburke/OpenRCT2/src/sawyercoding.c:87:3: error: expected expression before â)â token
0xf44078 is a count of the current possible ride configurations
0xf440a0 stores an index into ride_configuration_string_ids. ride_configuration_string_ids only stores information about track piece names.
0xf440b2 stores the previous track piece's slope
so does 0xf440b7, I believe but I'm not sure what is the difference between these two.
0xf440b3 stores previous track bank
0xf440b6 stores previous track bank as well.
0xf440a7 is an index to the current ride; this is frequently multiplied by 0x260 and used to index into rides
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
đ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. đđđ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google â¤ď¸ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.