Experienced Moron Facepalm

A forum for non-Suikoden related topics.
User avatar
Pyriel
Webmaster
Posts: 925
Joined: Wed Aug 18, 2004 1:20 pm

Experienced Moron Facepalm

Postby Pyriel » Sun Apr 26, 2015 1:55 pm

Around Thursday evening I reached the end-phase of a play-through of Suikoden that I was doing so I could test the Suikoden II save import. After completing Shasarazade, I decided I didn't want to spend a couple of hours manually sharpening weapons or using debug codes to get people in the state I wanted. I'd rather write a save-game editor so I can just click a few buttons and make people level 20 or level 99 with all the bells and whistles. Then I can test whatever scenarios I like quickly and easily.

I opened up the memory card file, thought about just grabbing the data I needed, and writing an editor for that alone, but it occurred to me that it would be useful to have a library for parsing memory cards. I went looking on Google, and finding none, decided to write my own. It isn't too difficult to parse them, and I got to the point where I had all the data streaming in and encapsulated in useful containers fairly quickly. Then I decided I'd like to try snagging the save icons and drawing them to the screen just to see how it looked.

I dragged out the old Windows snippets and documentation, and compiled the raw frames and palette data into device-independent bitmaps in memory, drew them to the screen, and was greeted by nothing by black squares. "What the hell," I thought, "I must have not copied in the data correctly." So I watched in the debugger and nothing seemed wrong. I added a few functions to retrieve the data back from the drawing area, and nothing looked amiss. I haven't done this for a while, so I thought maybe something had changed or been deprecated and started looking for samples and references and different methods. I could load bitmaps from files just fine, but nothing I did with the data from the memory card would produce anything but black squares.

I was losing my mind. I dragged out the Petzold Bible for the Win32 API, combed over MSDN, did dozens of Google searches, swore loudly, and contemplated various murders. Then, just as I was about to quit "forever", which might be as long as a couple of weeks, I looked at the code I'd written for compiling the palette, and realized I'd mapped the color values without any modification. Sony handles color values a little differently, so the difference between setting red to 1 and 2 is about 8 times more significant on a Playstation. It also means the maximum value for a color channel is 1/8th what you'd see on Windows and elsewhere. Setting the palette up that way, the best I could hope for is somewhere between a muted blue barely distinguishable from black, and a deep brownish color similarly close to black. If the icons were 1920x1080, I might have seen the different shades, but at 16x16, it's just black. I spent a total of maybe 12 hours trying to figure this out over the last few days, and the entire problem was, "don't forget to multiply, stupid."

Wolkendrache
Forum Moderator
Posts: 835
Joined: Sun May 18, 2014 2:43 pm

Re: Experienced Moron Facepalm

Postby Wolkendrache » Mon Apr 27, 2015 5:31 pm

I guess looking at your avatar makes it easier to understand how you felt at that particular point
"Within the four seas, all men are brothers" Shuihu Zhuan

User avatar
Pyriel
Webmaster
Posts: 925
Joined: Wed Aug 18, 2004 1:20 pm

Re: Experienced Moron Facepalm

Postby Pyriel » Tue Apr 28, 2015 8:01 am

Yeah, it's a fairly accurate portrayal of the last few hours. It just needs a haze of profanity floating around the edges.


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 5 guests