Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - creeperton

Pages: [1] 2 3 4 5 6 ... 17
Programming / Re: Half-assed disc image input and output
« on: September 06, 2015, 11:23:37 pm »
This tool doesn't make data larger or smaller.  It's only for editing data tables, specifically ones of fixed size; or ones where the table in total is a fixed size, even though the entries may be of any size.

There are a  few tables like that which contain in-battle technique learning trees, which terminate with a null character.  There are a fixed number of entries and each entry can be of any size, but the table in it's entirety must be equal to or less than a specific size.  I have no idea what will happen if I cut the table short and have a bunch of extra space left over at the end, but I'm sure it will do something literally retarded.  I also look forward to finding a way to represent this in a graphical user interface.

The interface will have to be a scroll pane.  On the left will be labels for each ability.  On the right will be combo boxes (aka selection boxes) from which you can select an ability or the null character.  If you select the null character, the rest of the combo boxes to the right of that null character for the same entry should be bumped down to the next entry, and everything left over at the end should be bumped to free space.  But since it's all data of the same type (combo boxes), I can use a grid layout and program the exact same action listener to handle that particular piece of logic, though I don't know how I'll do it.  Maybe I'll make each entry an array or a list of combo boxes and then split the list at the null character?

So yeah, it's all going to be exactly the same size.  Tools I make afterwards will have to change the size of files, though.

I'm not too familiar with cd images but I'm also thinking of creating an editor to some PS1 games later, so we kind of have similar problems. It feels a bit silly having to deal with these things considering that everyone in a similar position has to recreate the same stuff.. plus that cdmage already allows manipulating same-size extract/insert already. This is why Disch's Fischmare has an interesting project idea.
It's a nice idea, but it will never happen.  I've never met a single "computer scientist" who was willing (or able - maybe they don't know how and aren't willing to risk looking stupid) to explain things in a way that normal people can understand.  Because that's all I am; a normal guy who really fucking loves programming.

There are plenty of people who understand exactly how to create ecc and edc data, but they aren't willing to explain exactly what to do.  Once I figure it out (if I figure it out), I'll post the math and the specific bytes it uses so we won't have to go through this shit again.  The same goes for my code for working through a disc image, once I get it working (it's not right now).

Part of it is intellectual hazing - they had to figure stuff out on their own, and by golly you will too you, because it's good for you in the long run!  It'll make a man out of you, it'll toughen you up!  Never mind that this is the exact same attitude shared by the high school jocks who made their lives living hell.

Part of it is the computer scientists who plague my field.  From what I've seen, programming is working with somewhat human-readable interfaces glommed onto electrical engineering, with enough math and logic thrown in to keep you from having to spend years making stupid mistakes and learning from them.  Most of the people who call themselves computer scientists - and not programmers - at my school are academics who are too lazy to hack it outside of academia or people who just aren't interested in programming.  Lucky me!  I know guys who genuinely believe that you don't need to program a lot to be really good at programming, you just have to "be smart" - whatever that means.

Part of it is classism and snobbery - if you have to ask, you don't deserve an answer.  Or "I'll answer, but I won't include much that is immediately useful and I'll force you to read a bunch of useless crap before you get to anything really fun and interesting".  Because they wasted years of their lives (and tens of thousands of dollars) reading books that talked about programming and did very little actual programming, they now feel compelled to force the same thing on other people.

In my CS 161 class, we spent maybe 2 or 4 hours actually programming, and about 12 hours trying to figure out what the fuck the book was trying to get at.  We had to do pre-labs, so all this was done without any explanation and had to be done the day before class, so on top of all that time wasted the teacher wasted even more time unteaching us all the wrong ideas we got from the book. 

I spent maybe 20 hours working on my final project (the first real programming in the entire class) and I had a blast.  I could easily have done that workload every week, and had lots of fun doing it.  That's why I vastly prefer programming and planning over trying to figure out just what the fuck I'm supposed to do.  And even trying to figure out what I'm supposed to do is better than reading some god-awful specification that literally makes me hate myself and hate programming.  Why the fuck doesn't anyone just use a few tables of bytes and explain things with a key?

^Look at this!  Isn't it beautiful?  Isn't it simple and easy to understand?  Do we really need to explain this sort of shit to a non-programmer (or even a non-computer nerd)?  Why the fuck do people try to write to the widest possible audience, when only a programmer would ever use a specification?  When you write something to the widest possible audience, you ensure that NO ONE can understand it.

I have this sneaking suspicion that school isn't actually about programming, and is instead about beating the love of programming out of you.

You end up with people who can see what the problem is and how to solve it, but who remain silent both to "teach you a lesson" and to preserve their opinion of their own superiority.  The same assholes who talk about the "state of the community", no less.

Anyways, if any of these people really gave a shit about the "community", they would share solutions to common problems (or tools you can use to solve these solutions, like algorithms for common things) in a database or wiki that deals with these things.  Or they would share what they've discovered instead of talking about how cool it is and what they can do so far.  Or they would share anything at all.  But enough bitching for now, it's time for me to sleep.


If we can come up with enough info on mode 2, form 1/2 disc images, it might make more sense to just rip everything from the disc image and then rebuild it.  That would certainly make shit like compression easier.

Programming / Re: Half-assed disc image input and output
« on: September 06, 2015, 06:42:58 pm »
See my earlier post: mode is expected to be 02 always. Form1 vs form2 is about the subheader. Perhaps "00 xx xx 00" in subheader means it is a data sector..
Ah, so I need to check that bit in the subheader.  Got distracted and forgot about that.

one more question is whether you need to do anything where you need this knowledge? What is your tool supposed to do in the end?
I need a single method I can call when I want read something from a disc image, and another for when I want to write something to a disc image.  Some of the data I want to make an editor for is spread out over hundreds of files.  The location of this data within each file is determined in some cases by the header of the file, so I need to read that too.

It's fearsomely complicated and I've spent a month trying to figure out something that works.  I doubt I'll finish it before school starts.

I wouldn't be surprised if there is a max one file/sector limit. Just remember that the error detection and/or correction codes are in the end.
That's what it seems like.

Programming / Re: Half-assed disc image input and output
« on: September 06, 2015, 05:16:26 pm »
Ah, thanks a lot.

When this disc image has a little room left over in a sector data area after a file ends, it looks like it pads the rest of the sector and starts the next file in the next sector.  Is this normal behavior for PS1 disc images?


When I test if (Mode == 2), it prints EVERYTHING, but when I test if (Mode != 2), it prints NOTHING.  Unless I've screwed up somewhere, every sector in this disc image is mode 2.

On a side note, I just want to complain that files apparently start at 1 while pretty much everything else I've seen in Java starts at 0.  I should probably check if the sector count in this disc image starts at 1 or zero, too.

Programming / Re: Half-assed disc image input and output
« on: September 06, 2015, 01:42:18 pm »
The first actual game file - SCUS_942.30 - starts at sector 24 (0xdc80).  A few listings of folders before that, but no comprehensive list of game files.

The code I posted above doesn't work, I should get the data patching working before I work on that.

Just for shits and giggles, I'll write something that prints out the Mode byte and the offset of that byte.

Programming / Re: Half-assed disc image input and output
« on: August 31, 2015, 11:51:40 pm »
Regarding the rest of data in the sectors. If you are dealing with MODE2 images, you will need at least to recalculate ECC/EDC integrity codes for each sector, in order for the iso image to work on hardware.
What's the equation for doing that?  I want it to run as an eboot on a PSP, so I need to do this.

Programming / Re: Half-assed disc image input and output
« on: August 30, 2015, 03:16:05 am »
That's a really good idea.  It would prevent circular dependancies.


What should I do about the static Arrays and HashMaps in GUI.java that are referenced in GUI.java and also in Items.java?  They are String Arrays of item names, ability names, stuff like that.  The HashMaps are what I use to hold the entries for each data table - they save me from implementing a search algorithm.

I was taught that circular dependencies are bad design, yet I need to use all of these things in pretty much every class I make and I need to make an instance of every data table editor in GUI.java.  I thought about moving the things related to dealing with data structures to an abstract class that each specific data table would inherit, but I'm still not sure on the design of it all.  And let's be honest, this is an exploratory project for me to make mistakes that I learn from - I should have to refactor so I learn to what specifically to do to in the first place.

Programming / Half-assed disc image input and output
« on: August 29, 2015, 07:55:46 am »
The specification was too boring to get through, so I decided to half-ass it.  Here's my code, is it abstracted enough to reuse?  Yeah my javadocs suck, I like to put everyone on as few lines as possible until I'm in maintenance mode.


This is a long shot, but do I have to worry about the other stuff in each sector besides the data?

And this only supports *.bin/cue and *.img disc images <url=http://www.magiciso.com/tutorials/miso-features.htm>because MagicISO lets you convert between various types</url>.

I'm aware that asking "critique my code" is equivalent to "roast me", but I'm kind of proud of this half-assed piece of shit.
Code: [Select]
     * Write data in given dataStruct hashmap to a file
     * @param   String filePath path to the file, long sector in which given file starts, long position to begin writing, HashMap<String, Integer[]> data structure, int number of entries, int entry length, String[] array of names
    private void writeDataStructToDiscImage(String filePath, long gameFileSector, long positionInGameFile, HashMap<String, Integer[]> dataStruct, int numOfEntries, int entryLength, String[] arrayOfNames) throws IOException
        // prep the array to write from
        int[] dataStructArray = new int[(numOfEntries * entryLength)];
        for (int i = 0; i < numOfEntries; i++)
            for (int n = 0; n < entryLength; n++)
                dataStructArray[(i * entryLength) + n] = dataStruct.get(arrayOfNames[i])[n];

        //calculate starting position of data
        //0x9ee0 mod 0x800 (2048) = 0x6e0 (1760)
        //0x9ee0 / 0x800 = 0x4 (integer division)
        long firstWritableSector = gameFileSector + (positionInGameFile / 2048);
        long firstWritableAddress = (firstWritableSector * 2352) + 24 + (positionInGameFile % 2048);

        RandomAccessFile outputFile = new RandomAccessFile(filePath, "rw");

        long currentSectorAddress = positionInGameFile % 2048;

        for (int i = 0; i < (numOfEntries * entryLength); i++)
            if (currentSectorAddress < 2048)
                currentSectorAddress = currentSectorAddress + 1;
            else if (currentSectorAddress >= 2048)
                outputFile.seek(outputFile.getFilePointer() + 300);
                currentSectorAddress = 0;
            }//HMMM, this else-if should come first, and I should remove the else!  Found my first major fuckup.

General Discussion / Re: College Textbooks
« on: August 19, 2015, 05:53:53 pm »
Well that escalated quickly...

Imagine living through it!

General Discussion / Re: College Textbooks
« on: August 18, 2015, 06:58:41 pm »
We have a class called CS 272 - Low Level Programming that covers assembly language programming and some aspects of C programming.  That class doesn't have a required book, so I was curious what the 271 book covers.  I found it on amazon for $50.

As for putting my info out there - it doesn't matter.

I'm currently living in my truck (I got a truck!) and couch-surfing or living with my girlfriend.  I spend most of my time in Salem (population: 160,614).  Even if someone doxxes me, you can't exactly swat a truck like you would a house.

Someone threatened to swat me a few years ago while I was homeless, and it was just sad.  How do you swat a tent?

My personal information isn't on the internet, my name is commonplace, I don't stay in in location very long, I don't do anything illegal, I don't have family members, I don't have friends (I have acquaintances, mostly), I don't have a reputation of any kind (I'm a nobody), I know how to act around the police to put them at ease.  I am not a very easy target.  I try to dox myself all the time, I can't find anything about myself in any of the cities I've lived in for the past 12 years.

I have about a dozen usernames that could be linked to me by a thorough attacker but which provide false information about me.

Even if someone actually pulls something off and doxes me, I don't have much to lose.  If they destroy every physical good I have then I can start again with a few hundred dollars and be back where I was within a few months.

On top of all that I'm kind of nuts.  When I first became homeless I narrowed down my choices to:
* Work a shit job the rest of my life and try to get back into an apartment and get another car,
* Hitch-hike to a place with a better economy where it's easier to be homeless, or
* Get a passport and visa, and go fight as a volunteer in the Arab Spring (I was thinking of joining the Kurdish Pershmerga or one of the Assyrian Christian militias).

I went with hitch-hiking and homeless and here I am today.  It was fun in a crazy way, even while I was starving, freezing, sleep-deprived, dodging traffic, or dealing with crazies and junkies.  Probably the best thing that ever happened to me.  Even at the worst it was better than rotting away at my parents house or working shit-jobs and being rejected by literally everyone I met.  No matter how bad it was, I was never bored and I always had some new challenge to test myself against.  I met lots of interesting people and I saw an entire strata of society that is invisible to most people.

I have some programming ability, along with the street smarts and stubbornness that it took to claw my way up to where I am today.  I think of myself as a rogue training to be a wizard - in the D&D sense of the words.

So yeah, if someone utterly destroyed my life such that I have nothing to lose, I would want them to give them every opportunity fuck up.  I would do this because losing everything was good for me and I think everyone should experience it at least once in their life.  I guess that makes me crazy.  I've doxxed people before - script-kiddies and spammers, along with a few trolls - only now I am capable of just walking and hitch-hiking until I find them.  I spent a lot of time with ex-convicts while homeless, and they are a valuable resource for learning street smarts and people skills - plus they're huge gossips.

Ex-cons and especially junkies gossip a lot because they need info on other criminals so they can snitch to reduce their sentences.  I keep a reputation as straight-edge (and I actually am straight-edge, too), but that doesn't mean that I can't tell them about what the person who doxxed me does and where he lives, so they can snitch on him when they need to cut a deal with the local DA.

I wouldn't hurt them or break any laws.  Instead I would give them the opportunity to destroy their own lives.  Turn a bad situation to your advantage, so no matter what they do it hurts them and helps you.  Most of the time you don't need to do anything because the people who are into that sort of lifestyle - trolling, doxing for lulz, swatting, and "hacking" - do plenty of other illegal things, you just need to figure out what those illegal things are and then give them a chance to get caught doing them.

If I really wanted to fuck with someone, I'd learn how to set up a honeypot and bring all the people who want to dox me into it.  That's why I'm taking classes on IT stuff along with CS.  Within about a year I'll have the skills to work as a programmer.

General Discussion / College Textbooks
« on: August 18, 2015, 01:03:58 am »
Here's my CS 271 book:

CS 271 Computer Organization (4)

Logical organization, computer hardware, introduction to assembly and machine language programming.

Prerequisite: CS 162.
Can't buy the damn thing until September 8th.  Guess I'm getting it from Amazon then.

Anyone ever use it?  Is it good?

Personal Projects / Re: SnakeOil - SaGa Frontier data editor
« on: August 18, 2015, 12:58:17 am »
I just printed off 120 pages of specifications from this thread, specifically the post where Valendian takes me to the woodshed, so I have about a week of reading ahead of me.


Did you consider that the object may be tracking a "current position" in the file? I bet that there is a method to change that position.
The innermost stream classes in Java usually don't have seek methods.  I'll explain what I think is going on there later.

You are not supposed to randomly hop around in streams. Why? Because seeking back and forth on external memory like HDDs is slow as effing fuck (thousands of times slower than in memory). Hence why streams exist. They work linearily. You start and then work your way through it from start to finish without hopping back all the time. If you need to randomly access the data -> that's why you load the data into a buffer. That one is in memory and you can do what you want with it.

A stream object tracks its position by itself, there is no need to mess with it. If you need to, you are doing it wrong. If you check the documentation on File[Input/Output]Streams linked earlier in the thread you'll also notice that there are overloaded read/write methods that don't need any offsets and indicies, just a buffer and nothing else. Because the library can flush a stream into a buffer or vice versa by itself. It doesn't get any easier.
Thanks for taking the time to explain that to me.  Wish we'd spent time going over that in class instead of trying to figure out just what the fuck the author wanted us to take away in the previous night's reading.

I think with Java there are certain stream classes you're supposed to have wrapped around a file that have only basic methods for dealing with that file, while there are other streams you're supposed to wrap around that stream, and still more streams you could wrap around the previous stream to do more specific things.


Exactly what each of these are best suited to is a mystery.  On that note, how do I actually view the code that implements each of these classes?  If I saw how they were different, I could figure much of it out myself and I could learn how to implement my own stream.

Browsing wikipedia at the moment:


Even if they're not compiled, something that assigns 64 bits to each variable no matter what kind of variable it is kinda sucks.

Also what is the benefit of a language automatically converting between different types based on their own arcane rules?  To gently fail and try to preserve website as much website functionality as possible?  Are there any other advantages?

Are there any client-side web scripting languages designed to be fast and lightweight?

Some languages excel at one thing over another and it varies a bit depending on what you want to do.

In that case, what do most of the common languages excel at?  What niche languages are very good at specific applications?

... however I can not ignore the notion of rapid deployment or reliability/heavily bounds checked code (and that does rather exclude C and C++, even with things like Cyclone).

What languages are suited for rapid deployment?  What languages excel at reliability/heavily bounds checked code (and waht is heavy bounds checking)?

Are there any client-side web languages out there besides javascript?  Don't say java applets, actionscript, silverlight, or anything dead/dying/crappy.

What languages have the most possible applications?

Personal Projects / Re: SnakeOil - SaGa Frontier data editor
« on: August 13, 2015, 06:50:25 pm »
Yet another SnakeOil release: http://biolab.warsworldnews.com/viewtopic.php?f=18&t=296&p=1621#p1621

Currently functional.

* Implement file I/O for disc image.
* Make a better looking layout for item data editor. If possible fit this layout in a 1024 by 600 pixel frame.
* Incorporate feedback from users at GameFAQs.
* Consider using a JFrame instead of a popup for informational dialogs.
* Implement editors, patching, and file I/O for all known data tables in SaGa Frontier.
* Implement action events to highlight byte/bit GUI components if they deviate from values in base patch.
* Make a changelog generator.
* Make a data table preview generator.
* Make a better readme.

Your choice of compiled executable or source code.

This release can make a patch and do various things with them.  You still need to write to SCUS_942.30 to edit the game, but if you wish you can use the *.snakeoil patches to distribute your changes instead of making a PPF patch.

You can't open a RandomAccessFile inside a ZipFile or a ZipInputStream.  I prefer RandomAccessFile over streams whenever possible.

Everything works fine, I'm just wondering about the documentation of write(byte[] buffer, int off, int len) in FileOutPutStream.  I figured offset was the offset in the file to be written, but apparently it's the index of the buffer byte array.  This seems like a pretty dumb decision to me - no, scratch that.  It seems impossible to use because you can't specify the location in the file you're writing to.

So offset in write(...) references the location in the byte[] to start writing, and not the location to start writing in the file you have opened in your FileOutputStream?  That makes a lot of sense. /sarcasm

Am I being stupid or is that really easy to misinterpret?

How do I determine where I want this write operation to take place in the file I'm writing to?

Pages: [1] 2 3 4 5 6 ... 17