PDA

View Full Version : Code Question


Kolipoki
19th Jul 2009, 06:55 PM
I was going through the reflector and looking at the gameplay careers and using the disassembler i get this :


Business = 0x42001ac66370d0L


Is that just saying that the string that equals Business is 0x42001ac66370d0L?

Mootilda
19th Jul 2009, 07:36 PM
It's difficult to tell exactly what you are asking because your post is pretty short.

That is a long hex value. L means long. 0x means hex. If you don't understand the concepts of long and hex, you need to learn a bit more about programming first... these are basic programming concepts.

I'd have to do more research to answer your question, but my guess is that business is an enum and that long hex value is assigned to one of the businesses. I've noticed that the disassembler can become confused between long values displayed as signed, unsigned, or hex. In general, what I've found helps is to convert values between these three and then search for the enum definition.

If you don't understand the concept of signed, unsigned and enum values, you need to learn a bit more about programming first, since these are also basic concepts.

Kolipoki
20th Jul 2009, 12:03 AM
Yes i do need to learn some basic concepts, which is why im looking at lemmy's Il and DLL thing. I was just curious as to what it meant because that's all the thing says nothing else.

chann
20th Jul 2009, 12:22 AM
Hmm. Do you have a mod that enables the console command "ToggleStringID"? (I use AwesomeMod with EnableDebugCommands on.) If so, it's much easier to use ToggleStringID to display String IDs next to every string in the UI, and copy the String ID you're looking for into Snaitf's FNV Generator (http://modthesims.info/showthread.php?t=355292). You can use the FNV64 Reversed result to find the hash in the STBL.

Also, instead of reversing the hash, occassionally the first and last 8 bytes are swapped in the STBL (so the FNV64 hash 12345678FFFFFFFF would be stored as FFFFFFFF12345678 in the STBL).

Mootilda
20th Jul 2009, 03:05 AM
Again, you haven't given us any indication of where you found this line of code, so I'd have to do some research before I could say for sure. My guess is that the line should read Business = Business.Diner or Business = Business.Warehouse or something like that, but the disassembler is getting confused because it's having problems converting between the different possible representations of that value. You need to find where in the code Business is defined. If it's an enum, then you need to convert that long hex value to whatever data format is being used in the enum declaration.

ETA:

OK, I booted my development machine to see whether I could help. You're looking at the middle of an enum definition. The enum name is CareerNames. Business is the textual representation of one of the enum values. The long hex value is the internal enum value assigned to that textual representation. The entire enum definition (one line of C# source code) is 24 physical lines long. You really need to read up on enums.

I hate to say this, but you can't learn to program by asking people the meaning of a couple of words in the middle of a very long line of C# source code. If you are serious about core modding, then get yourself a book on programming, or take a course.