LogFAQs > #902056577

LurkerFAQs, Active DB, DB1, DB2, Database 3 ( 02.21.2018-07.23.2018 ), DB4, DB5, DB6, DB7, DB8, DB9, DB10, DB11, DB12, Clear
Topic List
Page List: 1
TopicGod damn people are so fucking bad at writing legible code
Yellow
05/27/18 5:52:56 AM
#1:


I mean, what is this garbage?

https://github.com/TASVideos/fceux/blob/master/src/cart.cpp

void setprg8r(int r, uint32 A, uint32 V) {
if (PRGsize[r] >= 8192) {
V &= PRGmask8[r];
setpageptr(8, A, PRGptr[r] ? (&PRGptr[r][V << 13]) : 0, PRGram[r]);
} else {
uint32 VA = V << 2;
int x;
for (x = 0; x < 4; x++)
setpageptr(2, A + (x << 11), PRGptr[r] ? (&PRGptr[r][((VA + x) & PRGmask2[r]) << 11]) : 0, PRGram[r]);
}
}


What is it doing? What is r, A, V? No explanation. Why would you make something open source if it's completely unreadable? That's the whole fucking thing, cryptic nonsense.

My code for comparison;

private void LoadRom(String file)
{
// http://wiki.nesdev.com/w/index.php/INES

Console.WriteLine("Loading " + file);
byte[] nesFile = System.IO.File.ReadAllBytes(file);

int file_pos = 0;

// Load header:
rom_header = new byte[16];
Buffer.BlockCopy(nesFile, file_pos, rom_header, 0, 16);
file_pos += 16;
...


You tell what I'm doing here, or at least make a good guess. I make use of the English language.

Sigh. Of course, PotD can tell me where I'm supposed to map my NES CHR ROM to my CPU mapper using NROM cartridge rips in my NES emulator, right? It's not telling me here, looking under the "Banks" section.

https://wiki.nesdev.com/w/index.php/NROM

Actually, I just figured it out, it's a little hidden. I'm honestly curious if anyone else will. This is like a really hard puzzle, but it's rewarding.
---
... Copied to Clipboard!
Topic List
Page List: 1