Showing posts with label reverse engineering. Show all posts
Showing posts with label reverse engineering. Show all posts

Sunday, 7 February 2010

Maniac Mansion Apple II beeper

Hi, it has been a long time since my last update.
TeenAgent has been implemented into the main trunk of ScummVM, however it is not based upon my engine, instead Vladimir approached the ScummVM team a few months back with a rather complete engine, the engine itself is very tidy and the game is in a completable state.
Congratulations are in order to Vladimir for his incredible work on the game, surpassing any progress I would have been able to make with my poor reversing and coding skills.
The project was great fun and an incredible learning experience while working on it. I would like to thank _sev, Buddha, salty_horse and jvprat for their patience with me while I was learning.
I would also like to thank john_doe for his commits for the music support, as TeenAgent used a strange and new module format for music. I have great respect for everyone who helped me learn. It will not be my last attempt.

I have recently been looking into the code used for Maniac Mansion sound effects on the Apple II.

A little history on the Apple II:
When Maniac Mansion was ported to the Apple II(around the same time as the C64 port) it was seen as a very ugly version, in comparison to the C64 version. It had some graphical issues and didnt include scrolling. Unfortunately the port also suffered in a worse way. While the C64 had the SID chip, an incredible sound chip allowing for some really interesting sound effects, the Apple II port had to make do with a REALLY basic speaker. The Apple II port used the speaker to generate some sound effects such as the character selection 'click'. Unfortunately the speaker could only output a square wave 'click' when the port was addressed(using a 'bit $C030 command) The speaker itself had not options for changing the output or frequency of the output.
This of course left games programmers with very little to play with, many of them came up with intelligent code that would call the speaker multiple times using various loops to 'click' their way into something vaguely audible. Maniac Mansion was no different. Lucasarts created a resource format which consisted of a collection of various bytes which told the code how it should 'click' the speaker.

The resource format is incredibly simple and the resource is simply read in by the code which judges how often and when it should click the speaker.

I am currently about half way through reversing the code(6502 ASM), I have converted about half of it to c++ and am planning on finishing the rest within the next few months(there isnt much, I just do not have much time with university commitments, as it is my final year any external work has to sit on the backburner until I get stuck with my university work :p)

I would like to thank Tobias for his patience with me, he has been especially helpful as he has not ever given me the answer, rather he provides ways for me to find the answer and makes sure I understand it. He has been so helpful in explaining some of the 6502 opcodes and explaining how they were used. I am greatful for his friendship and advice.

Though this code is not very complicated, I am still struggling to understand completely what it does. I am sure this will come to me.

EDIT:
I have documented all I know about the resource format on the ScummVM wiki here : http://wiki.scummvm.org/index.php/SCUMM/V0/Maniac_Mansion_Apple_II

Though this information is pretty irrelevant, since the code is what actually makes sense. The resource is simply a loop controller.

Monday, 2 February 2009

The current state of things

Recently I made the decision to ask jvprat to join the TeenAgent engine team

due to this progress has hit full speed !

We now have full support for the game animations(jvprat) :D

partial inventory support(jvprat) :D

and VERY shoddy walking code(provided by me) :(

The code has also been refactored thanks to jvprat, things are in a much neater state.

The current state can be seen in the following video.




Overall things are looking good for Teen Agent.

Wednesday, 14 January 2009

Animated Union Logic Software Publishing, Inc Logo

Well I figured out how to implement the static sprites in TeenAgent, and it turns out that these contain many other images that are used for animations,

It allows me to now implement the Union Logic logo fully,
this can be seen here with a comparison of the original/ScummVM



This now also allows me to view all the static sprites held in ONS.RES
which appear to be used in loads of places :D

Tuesday, 2 September 2008

TeenAgent

Im not sure if anybody actually knows about my blog, but I thought I would introduce my new project here, Currently I am looking at the game TeenAgent by metropolis software, Its a point and click adventure game and was the first game produced on CD in Poland. This project is an attempt to implement a TeenAgent engine in ScummVM.

There are two main approaches, the first is that I am currently in discussion with Metropolis about a source code release, they are yet to respond with anything more than 'we will speak to you about this soon' however Im reading into that as 'we are interested and when we get a chance we will sort it out.'

The second approach is through reverse engineering the TeenAgent executable.
I've made a little progress on this and since its my first real x86 reversing project Ive relied on a lot of help from Buddha^, jvprat and salty-horse.

currently I can tell when certain resource files are loaded I have located the pallete functions the file reading function, menu functions for save/load,quit,display ordering info,adjust music volume, adjust sound effects volume, adjust text speed, adjust game speed, adjust hero speed and change graphics mode.(greyscale/colour) I also have a few base functions recognised to control interrupts keyboard input and various other functions which arent really much use in creating the engine, rather I just named them to get them out of the way(so I know what they do and can ignore them for now)

with thanks to salty-horse I am now able to understand the file loading function and locate some of the various resources in VARIA.RES, the task now is to find out what these resources are by looking at the functions they reside in.

I hope to find some code which will allow me to figure out how one of the graphics resources is displayed, that way I can dump a graphics resource from VARIA.RES and write some code to load this in ScummVM that way I will feel like I have achieved something worthwhile.

Heres hoping that the next couple of weeks will bring some visual teenagent sexyness to ScummVM, or at least a start since I go back to university in about three weeks and I wont be able to work on it every day then :(

fingers crossed for a response from Metropolis and double fingers crossed for finding some graphics displaying code and ScummVMifying it.

Rob

Saturday, 19 April 2008

Maniac Mansion Famicom

Some people may know I was working on reverse engineering Maniac Mansion for the Famicom, If you know that then you probably know that its remarkably different to the version for the NES, the only thing that could be compared to the other versions of this game is the storyline.

My reverse engineering attempt for this game is quite slow and often stalls for months on end.
I will try and get an idea of where I am uploaded within the next month or so.

Incase anyone reads this and thinks they might be able to help out then feel free to comment.