GithubHelp home page GithubHelp logo

openrct2 / openrct2 Goto Github PK

View Code? Open in Web Editor NEW
12.9K 205.0 1.5K 213.44 MB

An open source re-implementation of RollerCoaster Tycoon 2 🎢

Home Page: https://openrct2.io

License: GNU General Public License v3.0

CMake 0.24% Shell 0.06% C 0.34% C++ 98.38% NSIS 0.05% XC 0.05% GLSL 0.02% PHP 0.01% Objective-C++ 0.05% Roff 0.03% Java 0.70% Python 0.03% Batchfile 0.01% C# 0.01% JavaScript 0.03%
c c-plus-plus game openrct2 cmake roller-coaster xcode visual-studio roller-coaster-tycoon msbuild

openrct2's People

Contributors

aaronvangeffen avatar adrian17 avatar broxzier avatar duncanspumpkin avatar frutiemax92 avatar gymnasiast avatar hdpoliveira avatar intelorca avatar janisozaur avatar jeroendstout avatar karst avatar kevinburke avatar lnz avatar lrflew avatar marijnvdwerf avatar openrct2-git-bot avatar overv avatar qcz avatar rik-smeets avatar rwjuk avatar spacek531 avatar tomlankhorst avatar trigger-segfault avatar tupaschoal avatar wolfreak99 avatar x123m3-256 avatar zaxcav avatar zedthree avatar zehmatt avatar zsilencer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openrct2's Issues

"Inspect memory state" button

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.

Access violation when trying to load any scenario

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.

Do you want bug reports yet?

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.

IRC channel and/or wiki?

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.

window_draw_widgets(w, dpi) not working properly

I'm working on the options window but it seems like our C function window_draw_widgets has trouble rendering groupboxes and checkboxes

left is with our code, right is with original code at 0x006EB15C
widget_draw_faulty

Build server is ready

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:

  • Replace 10 minute timer with a post-commit hook.
  • Support more than just the master branch. Pull requests, other branches etc.

Thoughts? :)

Guest can't enter the park

scr2

scr3

All guest remain stuck in the spot pictured above in the first picture. This issue only seems to occur for parks with a taller map height. I have include a 2nd screenshot for map height reference. The first screenshot was taken on the Grand Canyon park.

too low/ too high

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"

Text rendering glitches in some places when tooltips are drawn

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:

image

After mousing over anything that shows a tooltip:

image

Options menu with glitches

image

sv6 struct?

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.

Cannot get game to compile, issue with openRCT2.exe

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?

My mac compiler doesn't like intptr_t

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.

I can label discussions for you.

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.

Some scenarios fail to load

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.

game pause

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.

Cross Platform Support

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?

How to log output from C to the VS command line?

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.

Automatically detect RCT2 directory

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:)

Ride flags

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

update_ride_measurements seems to not do as expected

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.

more rct2 global vars

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.

Build server

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.

Bugs with in-game money

1.The money display in lower left doesn't update when necessary

  • Load any park (better the empty and closed one)
  • Try building a path (or a decoration)
  • The cash display doesn't update. Sometimes it updates partially, making the number look glitched: screenshot
  • It updates after dragging the screen, activating any window or when anything else updates the balance

2.Buying/selling breaks after launching the second park

  • Load any park
  • Close it and open the same or another park
  • Whatever you build or sell, the balance doesn't change at all, even the floating numbers with cash spent don't appear. All the non-player actions (people buying tickets etc) still affect the balance.

Error opening browser window for first start configuration

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:
browsererror

And then the executable crashes trying to access the wrong address. Here's the exception VS gets:
vsbreak

Building on Windows 7 x86, VS 2013 Ultimate

Potentially uninitialized local pointer variable in game.c

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.

Camera Movement + Cursor.

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)

Reference to OpenTTD

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.

RCT2_ERROR related build failure

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

Ride data summary

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.

[wiki] How to translate "offset sprites"?

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.

More info on the project?

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?

GAME_PATH purpose?

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?

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.