agris
Arcane
- Joined
- Apr 16, 2004
- Messages
- 6,925
Twiglard can you break it down to the level appropriate for someone who can pseudo interpret the code as I did, but only understands bitmasking in the context of masking (filtering) a binary data stream, such as over a RS232 connection, to extract usable information?
they're essentially just constant values, at most they'll take up a small amount of space in the .rodata section(or whatever the pe32 equivalent is)According to Cyberpunk 2077's leaked source code, China-related censorship flags are named "Winnie the Pooh"
I’m not a programmer by any stretch, but does this code snippet indicate that CDPR reserved 2^32 values in memory (uint32) to store an enumerated list of… 8 values?
According to Cyberpunk 2077's leaked source code, China-related censorship flags are named "Winnie the Pooh"
I’m not a programmer by any stretch, but does this code snippet indicate that CDPR reserved 2^32 values in memory (uint32) to store an enumerated list of… 8 values?
it could have been done with a byte-sized value but the sizes are so small that it really doesn't matter, and they likely didn't know how many values they'd actually have so they gave themselves some room to add moreTwiglard and rusty_shackleford while I understand Twig’s response more than rusty’s, in either case I fail to see how reserving a uint32 memory chunk makes any sense for, at implementation, 8 different binary flags.
Are the binary equivalent values of the variable names stored in the enumerated sequence as well? Ie “Censor_nudity”? If so, 32 bit makes more sense.
Thanks, your response clearly demonstrates I’m asking questions for which answers are over my head. One point tho regarding your comment:According to Cyberpunk 2077's leaked source code, China-related censorship flags are named "Winnie the Pooh"
I’m not a programmer by any stretch, but does this code snippet indicate that CDPR reserved 2^32 values in memory (uint32) to store an enumerated list of… 8 values?
Yes, but this is normal. "enum" by itself does not guarantee any specific size and explicitly specifying Uint32 you make sure that it uses a 32bit number regardless of what the compiler would pick by itself (by default "enum" would be like "int" which in some platforms is 32bit while in others is 64bit). As these flags are parts of structures serialized to disk you need to have them use a constant size regardless of compiler, platform, etc.
Now in this very specific case it'd "waste" 3 bytes indeed, but aside from that being an irrelevant number, if someone declared it as "enum CenshorshipFlags : Uint8", it'd still waste 3 (or actually, most likely 7) bytes regardless: the reason is these flags are used in "struct" and "class" declarations which have members that are going to be aligned in memory anyway by inserting "padding" (ie unused) bytes between smaller members.
Regardless these numbers are tiny and it pointless to even try and think about them - a single texture is most likely going to use more memory than all these tiny pieces of unused memory all over the engine combined.
Thanks, your response clearly demonstrates I’m asking questions for which answers are over my head. One point tho regarding your comment:
“Regardless these numbers are tiny and it pointless to even try and think about them - a single texture is most likely going to use more memory than all these tiny pieces of unused memory all over the engine combined.”
Isn’t this the sloppy thinking that gives us computationally inefficiency code such as Unity which merely takes computing power increases and translates them to a lower and lower programming standard such that mouth breathers such as myself can code, without concern for how code is compiled to assembly and executed on bare metal?
for example, in searching uint32 for C++ enumeration, I stumbled upon a description of cache efficiency and branch predictor accuracy during run time as a function of “wasted” bits for enumeration. If you call a list a lot in a piece or code and it’s assembled poorly such that there’s a lot of wasted computation in simply parsing the enum, it’s size (32 bit) isn’t really relevant vs the size of a texture. It’s relevant in how it impacts the execution of code at an instructions per cycle (IPC) level, ie on bare metal.
Isn’t this the sloppy thinking that gives us computationally inefficiency code such as Unity which merely takes computing power increases and translates them to a lower and lower programming standard such that mouth breathers such as myself can code, without concern for how code is compiled to assembly and executed on bare metal?
for example, in searching uint32 for C++ enumeration, I stumbled upon a description of cache efficiency and branch predictor accuracy during run time as a function of “wasted” bits for enumeration. If you call a list a lot in a piece of code and it’s written poorly such that there’s a lot of wasted computation in simply parsing the enum, its size (32 bit) isn’t really relevant vs the size of a texture. Its construction IS relevant tho in how it impacts the execution of code at an instructions per cycle (IPC) level, ie on bare metal.
Twiglard I selfishly wish you were more verbose so I could learn from you - as is, your answers are cryptic verging on the indecipherable.
although I do take your point about optimization; as does specter, meltdown and the other associated microcode vulnerabilities!
You cannot use a leaked source code for anything useful without opening yourself up to a lawsuite and/or cease and desist letters. Hence, it doesn't make a difference for modders or other developers. You can, however, look at the leak source code and educate yourself on how it works. Given that it is probably multiple million lines of code, it will be hard to find the actually interesting parts. Progams of this size can turn into an incredible mess if you're sloppy and I think we savely assume that CDPR was sloppy during their development.Wait, the game source code was leaked.
Is it "open"? Can people actually use it?
So the game is essentially broken at an engine level?
Does that mean there's no way to fix it, except by fixing the engine first?
You cannot use a leaked source code for anything useful without opening yourself up to a lawsuite and/or cease and desist letters.
According to Cyberpunk 2077's leaked source code, China-related censorship flags are named "Winnie the Pooh"
I’m not a programmer by any stretch, but does this code snippet indicate that CDPR reserved 2^32 values in memory (uint32) to store an enumerated list of… 8 values?
According to Cyberpunk 2077's leaked source code, China-related censorship flags are named "Winnie the Pooh"
I’m not a programmer by any stretch, but does this code snippet indicate that CDPR reserved 2^32 values in memory (uint32) to store an enumerated list of… 8 values?
A 32 bit integer does not have 2^32 "values" in memory. A 32 bit integer has 32 bits. 32 bits can represent a number up to 2^32. In this case they are using 8 of those 32 bits as flags instead of as a number. This way you can have 00000000 for no flags, 00000001 for just nudity censored, 00000011 for nudity + sexually explicit, 01010101 for nudity + suggestive + gore + religion censored, and so on. Yes they are only actually using 8 of those 32 bits, but this ensures they have room for expansion and is incredibly minor to begin with. A single megabyte of memory has 8 million bits, "wasting" 24 of them is irrelevant unless this is some kind of insanely important performance-critical code that needs to fit into a tight CPU cache or something because it's executed thousands or millions of times per frame, which this isn't.
Wait, the game source code was leaked.
Is it "open"? Can people actually use it?
So the game is essentially broken at an engine level?
Does that mean there's no way to fix it, except by fixing the engine first?
i think its like a page or two backToo lazy to read through the whole forum but has anyone linked here the leaked footage from the 2013 build?