Assembly Editing and Reflexil Instruction

[You may want to sticky this in the mods forum as this is purely a resource thread for modifying the Assembly-CSharp.dll]

ASSEMBLY-CSHARP.DLL

The amount of modding now taking place in the Assembly-CSharp.dll is increasing. Over the last month, my mod, which normally involved changing some random variables, started to become getting more complex, with several new functions being created. As we're currently using ILSPY and REFLEXIL, changing code isn't as simple as writing some C#, but rather altering the 'instructions' and 'opcode' in the dll, altering the code indirectly.

I was talking to Hudson (who many of you may remember did the original blue-flag fix) who taught me how to use these tools, and we talked about storing our changed codes somewhere, mostly for reference, but may benefit some other modders who wish to change their own dlls - or maybe get some more people into modding the game in general.

EDITING THE ASSEMBLY
To edit the Assembly-CSharp.dll you will need:
ILSPY (http://ilspy.net/)
REFLEXIL pluggin for ilspy (http://reflexil.net/)

I'll post below examples of modified code and what they do (I won't show simple number changes, as that would not really be showing anything at all). I'll focus on the areas of the game I have modded as part of my Balance Mod where changes to code has taken place. I won't do them all at once, but when I find time I'll share the code and some insights here.

Others who are modifying this file, please share your work also so we can get a decent database of changes.

UPDATE:

New Editing Techniques

So, when I first started modifying the code, we could really only go one level - via an Injector, I could change some values. Then, one day, we leveled up! Level 2 let us use Relfexil/ILSpy to edit more of the code and begin really making some changes.

This weekend we upgraded to Level 3! We have a new tool provided to us (and thanks to Robery Eady who provided the link). Now we have DNSpy. https://github.com/0xd4d/dnSpy/releases

What's so special about DNSpy? Well, this:

R49IbZLdo.png

Yes! We can now edit the code directly using normal coding methods!

As an example, in just a few minutes, I created that so during a collision, the part chosen is more random.

Original ILSpy
R3vUJgqc4.png


Edited with DNspy
R439hjgha.png


Checking with ILspy that everything is fine!
R436ZRmNY.png


And it works fine!
Race 1:

R3Y7Tcz52.png

R3Y5dvH8Y.png

R3Y3xX60S.png

Race 2:

R42396clE.png

(obviously, damange to these parts isn't going to be added to the mod, but I could have collisions to the rear mean its Rear Wing Damage 20% of the time, and Suspension 50% of the time, and no damage the last 30% of the time)

What this means for the mod

So, now I can edit the code, this means that:

  • I can make far more complex changes.
  • I can make them faster
  • As I am literally changing code, I can copy all my changes into a .txt document. This means that when I have to update the mod to a new dev patch, I can use CTRL+C and CRTL+V to update an entire class, instead of spending an hour having to remake the opcodes!
This means that I can now add as many features as I desire, and I am nearly unrestricted. Because, though I have not began to test it yet, DNSPY has this:

R4myWUclO.png

If I can add classes, I can create entirely new features from scratch. Define new variables, craft new systems. I can make as many rules and manipulate variables however I wish to craft them. This means I can probably make new 'Season Rules', extend the amount of tiers, bascially anything I want.

I still cannot make new "Game Objects", or make new UI, but the scope of watch's acheiveable has probably increased 10-fold. Which is why I asked for wishlists... Anything Code Related is probably now possible. Some things will be simpler then others, but now almost anything is possible.

All this means is that we have New Powers. And more importantly, it means more people are probably going to be able to edit the code themselves (learning opcodes is was a new and long process, but as a mathematician, I can IF and For anything with ease just from seeing examples). This may mean I can get some more collaborators and help making new features!

 
Last edited:
yeah i made the changes in the relevant .txt files, I'll be honest it surprised me when it worked, I didn't think I would even have a functioning career mode, never mind all the sessions working as intended barring the ui obviously, it's not perfect, i'm not familiar with coding at all, just used years of tedious modding to try and work it out, was just a case of looking for any references to the numbers, I worked off the assumption that the game had a few maximum values, which I extended, I'm not sure though which effected what though, I wish I knew a bit more about what I was doing.

In terms of teams, i just added two team's from the tier below, but I'd assume it may be possible to add more championships (and teams) too.

To answer what needs to be added, just UI and references to expected finish, I imagine, but it could extend to relegation/promotion as mentioned by someone else. by default when you get asked where you think you'll finish it'll give you the choice of 8th and two 9's weirdly. You may have noticed in the frontend.txt file there are strings for 1st all the way to 99th, I know that's probably just to cover all the bases, it's interesting.
 
by default when you get asked where you think you'll finish it'll give you the choice of 8th and two 9's weirdly.
I actually edit this in my mod already... this is in Chairman - GetEstimated Position... Capped between 1 and 10 would need to be exteneded to 1 and 12.

This is a project I am happy to assist in now that you've got this far. Care to share some screenshots of the effected areas where the game stuggles with 12 cars - I might be able to quickly solves some of the problems given I've had my nose in this file for months now.

I've tried adding extra and less cars to a tier without much success atm. So you must have found a team limit trigger I never noticed. I've also tried to make an additional tier without much luck... Probably because there is no model associated with a unmade tier 6
 
It's your mod's dll i've been working with anyway, I like the changes that makes even just on its own, and yeah I'll sift through it again and mark down what I think I changed, as you know it's not small by any stretch lol.

What I do think is it seemed to work at least to some extent was with only one change which was in the CircuitScene section, where i extended the gridboxes from 20 to 26 (I don't know why i chose 26, but I just wanted to see what happens) it'll be curious if we can even go above 24, but i'd imagine that would either mess the game up or the cars would simply share pitboxes, obviously I don't know what would happen with hit detection if that were the case, but i'll give it a test.

Also the all drivers get points rule is only adjusted to cover 20, there may be something in this file that can be altered to cover more, but it's not super important, editing a new point rule into the rule changes file to cover the extra cars would work as a possible alternative solution, though it's not perfect obviously.

As for the screens that need changing, it's mostly the Standings bar on the left during practice/quali/race (might be possible to add a scroll bar?) and the starting line-up screen that can't fit all drivers in, though they still appear, it cuts them off a bit more with more cars added, similarly to the choose team bar when starting career, with 12 teams you can just about click on all the selection boxes. Oh and also the standings when simulating a session only cover's 20 cars, the other cars still place, they just don't appear on this screen, but when you get to the end of each session the times are still registered, so as I was saying, it works as intended, it's just UI limits at this time.
 
Last edited:
It's your mod's dll i've been working with anyway, I like the changes that makes even just on its own, and yeah I'll sift through it again and mark down what I think I changed, as you know it's not small by any stretch lol.

What I do think is it seemed to work at least to some extent was with only one change which was in the CircuitScene section, where i extended the gridboxes from 20 to 26 (I don't know why i chose 26, but I just wanted to see what happens) it'll be curious if we can even go above 24, but i'd imagine that would either mess the game up or the cars would simply share pitboxes, obviously I don't know what would happen with hit detection if that were the case, but i'll give it a test.

Also the all drivers get points rule is only adjusted to cover 20, there may be something in this file that can be altered to cover more, but it's not super important, editing a new point rule into the rule changes file to cover the extra cars would work as a possible alternative solution, though it's not perfect obviously.

As for the screens that need changing, it's mostly the Standings bar on the left during practice/quali/race (might be possible to add a scroll bar?) and the starting line-up screen that can't fit all drivers in, though they still appear, it cuts them off a bit more with more cars added, similarly to the choose team bar when starting career, with 12 teams you can just about click on all the selection boxes.
rule changes.txt would be the lace to edit the point numbers for all point grids.... I think it is current {20,19,18,17.....3,2,1} so it's probably possible to just change that to {24,23,22,21...3,2,1}. That's assuming one wants to go down that patch. I often wondered if we could have a 'not all same number of cars' Championship. - but then I've never looked to test the theory, I never got as far as you on this, but a lot of the dll talks about team.count rather then assuming there are 10 teams exactly. We could have one series with 10, another with 11 and another with 12 potentially, depending on how the code works practically. At the moment, if I only have 9 cars in a championship, the game does crash.

I have no idea about adding scroll bars, I'd gues not but you never know. At the bottom of the dll is a huge set of UIGameAreaName fields with all sort of things to change, maybe we can up some stuff there,

As for hit detection with even more cars, I believe the entire environment doesnt have any hit detection (only car vs car) So even if it just extenteds the pit lane and their pit is a bit of 'field' they'd be happy.

Edit: care to share the file so I can have a look? Pm if you rather not release it publically.
 
Last edited:
Yeah, i'm just currently adding the changes I made to notepad to send to you, I'm purely working off of guesswork, as I said before i've never coded anything before in my life, but I have a general idea of what I should be looking at, it's looking promising though that we can have bigger series' which I wanted anyway because i've been working on a fantasy race series for personal and maybe others' use.

Edit -
yeah i'll share what I know anyway, no point in keeping it all to myself, not my style to do so.
As for the mod i'm working on, it's just a fantasy series i've been running on various games since childhood, you know the usual fare, friends/former friends and made up drivers mixed together, driving for fictional teams with their own history, I do plan on sharing it in some form anyway when it's done, what would be the point in all that effort otherwise.
 
Last edited:
Yeah, i'm just currently adding the changes I made to notepad to send to you, I'm purely working off of guesswork, as I said before i've never coded anything before in my life, but I have a general idea of what I should be looking at, it's looking promising though that we can have bigger series' which I wanted anyway because i've been working on a fantasy race series for personal and maybe others' use.

Edit -
yeah i'll share what I know anyway, no point in keeping it all to myself, not my style to do so.
As for the mod i'm working on, it's just a fantasy series i've been running on various games since childhood, you know the usual fare, friends/former friends and made up drivers mixed together, driving for fictional teams with their own history, I do plan on sharing it in some form anyway when it's done, what would be the point in all that effort otherwise.
sounds good. I'm quite happy with the idea of expanding the Vanilla world (I still kinda like the Vanilla teams vs real life ones) and the temptation to pit Flaming Red Racing is high, and every week I keep wondering if I should just replace ZRT with it ;) and have it ready for me to join one day once I am done with gt).

In all honesty, 90% of my coding ofnthe file was based off of guesswork I'm always surprised when something works,
 
Yeah, I don't think that'll be possible, it was more giving you an idea of what it is supposed to be like, a bit odd, a bit crazy, a bit too fast lol. It's a shame that the oval track doesn't work exactly like it should with the cars driving on the inside part rather than the banking.
 
Someone please figure out how to make the choices made in chassis development change the car model... would be so cool in GT. ;)
I assume you have seen the announcement from Chris in the Ice and fire mods,

:)

Okay, spend all day investigating the file with 12 teams. There are some limitations I can't figure a way around, but if you could 'overlook' those, the concept is extremely functional

Pros:
  • Shaun indeed has indeed got 12 functional teams going, both in quick race and in the career championships.
  • The AI works as it normally does, unimpeeded by these new cars.
  • With some minor edits several things which are limited to 10 cars only can be adjusted to 12.
  • All these teams show up in the championship standings, and most race reports.
  • Overall, it's extremely functional.
Cons
  • Several other unknown bugs may be present, The team selection screen cuts off 80% of the two new logos on car selection. They're selectsble still (at least at the resolution I am using) but most the logo cannot be seen. It's a minor thing which you only see once, so I've not even attempted to fix it yet,
  • The position tracker (the fancy line graph), the left race widget which has the live timing, and the live timing when skipping a session only show the top 20 cars. All attempts today to correct this have failed so far.
    • The issue here lines in FullStandindsDropdown and StandingsEnrty. In FSD there is a variable sting called mStandingEntry... and where it should have 24 values within it, one for each car, but it only has 20. So somewhere here or related, this variable isn't taking account the fact that there's two new teams, after several hours of narrowing this down identifying the issue, there's no obvious solution. But I urge other people who know coding to have a gander and see if they can see something obvious I am missing.
    • However, if you're happy ignoring the time sheet of the final 4!cars in these areas, then no action needs to be taken (if the player is in 21-24th, you'll still be able to see surrounding cards with the tracker just above the driver portraits, as these move with your position. All other race result sheets show all 24 cars.
  • The rollover effect for the Rankings of your Individual Car Parrs and seeing how you rank in HQ, Car, Sponsors, Drivers and Staff cause a crash. This may be a similar issue to the above, which may or may not be fixable. To combat this for now, I can remove the Rollover Effect from spawning. This prevents the crash and also stops the player knowing exactly where they rank. This might be a perminant solution if no others have been found
There maybe other issues not ran into yet, and whilemthe game is hobbling a little bit with a twelve car series, it does work really quite well, I urge other modders who know some coding come have a look and work on bug squishing.
 
Looks fun. :D
- I guess when active it will effect all the series (all 5 series). So 10 new teams. Are the available driver and staff numbers enough for 12 teams (20 new drivers and mechanics + 10 new designers).?
- Also instead a rollover menu can't we get the rankings in some other way? Monthly mail or just a ranking number under the part graphs?
 
Are the available driver and staff numbers enough for 12 teams (20 new drivers and mechanics + 10 new designers).?

I don't think so, but one can easily use the drivers & staff randomizer that's here on the forum, and copy-paste some of them to text files, just changing the team number. That's what I'm already doing now with the GT teams, that the randomized does not support at the moment.
 
Currently, this has only been tested with WMC with two APSC moved to it (reducing ASPc to 8 teams which itselfis casuing issues... however, ERS with 10 teams still is fine on the surface.

Maybe someone can make a teams.txt and a chassis.txt and defaultparts.txt and Championships.txt ready with 12 teams in all series. And some grab a drivers.txt and mechanics.txt and engineers.txt to populate the new teams. We can then try seeing if we can get 12 working everywhere, instead of WMC.

Theresa couple of other files which indeed need adjusting (Shaun has a SingleSeaterDesignData.txt which is already nice to new cars). And I'll have to clean up the .dll to prevent the ranking crash again. So there's a small weekend project for someone there. But I'll open up my Discord channel Monday where me and Shaun trouble shooted this yesterday, and we can get a set version setup for a small group of testers to see what other issues lie in wait and if any issues can be patched out.

And no, can't get the roll over numbers at all at the moment, so unless Brian thinks he can get them in a mail, I doubt it's doable

This is because the ranking 'creation' bugs out, I assume because - (like the race widget entry) that one part of the game is happy with 24 cars and 12 teams, while a second area is locked to 20 cars and 10 teams... so they meet and explode. This is defiantly the issue because in ASPC (8teams) the rankings still appeared without a crash, but it used Steinmaan as both team 9 and 10! As some sort of default).

The only way to fix it would be to make whichever parts that are locked to 10:/20 to adjust them and make them look at 12/24. But it's a pain identifying where this happens, because it isn't just a value "bob=20"l it's an unseen Array being created "bob=1,2,3,4,5,6,7,,9,10" instead of "bob=1,2,3,4,5,6,7,8,9,10,11,12" where these numbers are information about teams or cars.

Really, it needs someone with some experience with creating arrays in unity to have a look, as I know each program handles array manipulation a little differently. And even then it may not work, depending on how the objects are set up.

But again, it requires some overlooking some rather large bugs, but it's functional at least. And over time, much like I did with the balance mod, (like discovering frontend.txt) maybe we can find some fixes as we go along.

Anyway, I think it would be best is Shaun started a new thread about this, as I think the concept of 12 team is big enough to warrant its own section.
 
Here are some randomized files for drivers, mechanics and engineers (simple copypaste to have enought teams, with no balancing whatsoever). Can't do the others now, since I'm not home.
 

Attachments

  • Drivers.txt
    70.6 KB · Views: 490
  • Engineers.txt
    13.8 KB · Views: 366
  • Mechanics.txt
    23.6 KB · Views: 391
Hi Everybody. Here are the Championships, Chassis and Default Parts files for 12 teams.
 

Attachments

  • Championships_12.txt
    2.3 KB · Views: 423
  • Chassis_12.txt
    1.3 KB · Views: 363
  • Default Parts_12.txt
    21.4 KB · Views: 330
Last edited:
I'll have a look at seeing if mail can be triggered (could probably piggy back on the preseason testing results mail at the very least), all I need to find is what the rollover tooltip calls and see if the mail can call it too.

EDIT: Can anyone find the PSGs for these tooltips? I looked all through Frontend and couldn't find anything (other than other bits of cut content, which I hate finding because it's usually cool features).
 
Last edited:

Latest News

Do you prefer licensed hardware?

  • Yes for me it is vital

  • Yes, but only if it's a manufacturer I like

  • Yes, but only if the price is right

  • No, a generic wheel is fine

  • No, I would be ok with a replica


Results are only viewable after voting.
Back
Top