Monday, December 31, 2012

Japanese Track Support

The original Japanese release of OutRun had different track layouts to the final Western release. Overall, the game is tougher with sharper unforgiving hills, and more aggressive turns. 

This selection of tracks is less polished; Coconut Beach is nowhere near as rich in terms of design and the overall difficulty curve doesn't feel as good. 

However, it's great to see the evolution of the track design between versions. And Gateway has some cool twists and turns that were removed due to it becoming an easier stage in the Western version. 

The next Cannonball release will optionally allow you to play both versions of the game. It needs a little more testing (i.e. playing) before it's safe to release. 

Devil's Cannon is known as Walls in the Japan version. The layout and sky colour are different.

Japanese Course Map

Japanese Coconut Beach. Not as cool as the final version.

Sunday, December 30, 2012

Cannonball 0.13 - Custom Music, Menu System & More

Cannonball 0.13 is out!
There are a lot of changes, so it's possible there are also bugs. Please report anything you find.

Music Customization



Configure Cannonball to play WAVs instead of using the inbuilt game music. Configure the name of the replacement tracks for full ingame integration!

Please note, I do not intend to support additional file formats like MP3. This is a decision to avoid bloating the codebase with third party libraries. Convert your files with a free audio editor like Audacity.

Menu System



Now you can configure Cannonball without editing the config.xml manually. Note that some options are only available in the config.xml though. 

High Score Saving

Scores are saved to a human editable hiscores.xml file. Edit the high score table manually!

Control Enhancements & Gamepad Support

Digital gamepads are supported. You can even change the digital sensitivity, so you can recreate the twitchy Sega Saturn conversion experience if you desire. Be sure to connect your gamepad before starting Cannonball.

All keys and joypad buttons are fully configurable.

I will support analogue whenever I buy a controller for testing. Or if you're in a hurry you can donate me one. :)

More Options & Bug Fixes

There's an app icon, ability to toggle extra level objects, fixes to the mingw compile and more. 
Check out the commit history for more detail. 

I will update the online manual tomorrow. 

Monday, December 24, 2012

Space Harrier Wiwi Jumbo Music Data In OutRun?

Whilst creating Cannonball, I uncovered a large section of unused YM2151 music data in the Z80 program code. Initially, I was excited - could this be an unreleased Hiroshi Kawaguchi classic? 

Unfortunately, after hacking the code to play the data it sounded like garbage. I wasn't sure if this was a problem with MAME's emulation, so I asked Alex of the OutRun bootloader project to play the sound on hardware. He sent me the results, which you can download here as an MP3

It still sounded wrong, so at this stage I stopped investigating. It wasn't until later that night when I randomly happened to be playing the Space Harrier soundtrack on vinyl, that I came across the following composition:



I wonder if this is the Space Harrier Wiki Jumbo track embedded, but playing incorrectly due to other modifications to the sound code? It's a shame, because otherwise we could have hacked OutRun to have an additional tune. Perhaps it's still possible with some additional work...

This maybe isn't a big surprise, we've already uncovered other segments of Space Harrier in the OutRun code.  

Cannonball news - I'm implementing a nice front-end menu, with lots of cool configuration options. Expect a new version after Christmas. 

Monday, December 17, 2012

Cannonball: Widescreen Support

The play area can now be extended to widescreen. The internal resolution is set to 398x224, which is approximately a 16:9 aspect ratio. This means the screen is 25% wider and you get to experience more of the game world. The widescreen mode can be played windowed or full-screen as normal.



There are some things to note about this mode:
  • The music selection screen and course map screen still display at 4:3, due to art limitations.
  • The tilemap x-scroll position is different, to compensate for tilemap wrapping. So the backdrop position will be slightly different to the normal mode.
I've updated the source code and the Visual C++ binaries

Sunday, December 16, 2012

OutRun In Widescreen

Hey, guess what I'm working on.... and this is just 60 minutes of work...




Still a number of bugs to be fixed and things to be figured out before I release this :)

Update: It's done. It's actually quite awesome to play OutRun like this. I'll post some binaries later this week after further testing, or you can build right now from the develop branch... 

Saturday, December 15, 2012

Cannonball: Open Pandora Port

Congrats to Seb, who has ported Cannonball to the Open Pandora handheld. 



Download it from the Cannonball binaries page. More details, including the source code, can be found in the thread here.



Currently, it's running at 30fps but does support the other bells and whistles. Reportedly, it's a better experience than playing OutRun under emulation on this platform. I've rolled some optimizations into the develop branch on github, which should help ports of this nature.

I apologise for the lack of updates recently. Sadly, my house got broken into so I've been busy organising personal matters lately. Some OutRun memorabilia was stolen too which was a real shame as it is probably not replaceable  and will no doubt just be junked. On a positive note, I'm going to investigate a genuine wide-screen mode for Cannonball as my next endeavour. 

Wednesday, December 05, 2012

Cannonball - Full Screen & Options Update

Firstly, thanks for the kind words and interest surrounding the project. It's much appreciated. I've taken some of the initial feedback on board and released a new version. 

The highlights are:
  • The beginnings of the configuration system. Currently, its an XML file you must edit manually, but this will eventually become a cool in-game GUI.
  • Full screen support
  • Scaling in windowed mode
  • FPS options. Disable the 60fps mode to recreate the original experience. 
  • Gear options (automatic option & support for cabinets with a switch based shifter)
  • Configurable traffic (including the ability to disable traffic entirely)
  • Configurable time (including infinite time)
  • Advertise sound option
  • A new online manual available here
  • MinGW build now includes necessary DLL files
  • Visual C++ build definitely built in release mode this time :)

Binaries are here.
Source code is here. (get compiling for some different platforms!) 

I'll be taking a break from coding over the next week, before diving back in and adding configurable controls. 

Sunday, December 02, 2012

Cannonball Source Code Release

I'm delighted to announce the release of Cannonball; a portable C++ OutRun engine. This is the product of many years of reverse engineering, hacking and debugging.

The entire OutRun codebase has been decompiled and rewritten from scratch in C++. This extends to the Z80 sound program code and therefore full audio is supported.

Not only that, but the game now runs at 60 frames per second and many bugs present in the original code are eradicated.



This is just the beginning. Future releases will include a full menu, proper control, video & audio configuration  plus an array of options and game modes not present in the original game.

I'm hoping to find OutRun enthusiasts who will port Cannonball to a variety of platforms. I'd love to see Linux, Mac, Wii, Raspberry Pi and other platforms supported. I will facilitate serious offers of help. We can ensure that any changes make it into the master branch, so it's easy to keep ports up to date.

The codebase isn't perfect; the original code from 1986 can prove messy and inconsistent. Some of this is naturally carried through to the rewrite. For now, the focus has been on the accuracy of the conversion, at the expense of serious refactoring. But that's not to say this isn't a viable future goal. And I've been working on this long enough, it's time to release.

Why do this? Because I love OutRun, and no one else would have done. Thanks to those who have followed the project up to this point. Any questions - post them below!

Sunday, November 25, 2012

OutRun Toolchain & Bootloader

Here's an amazing project from blog reader Alex Bartholomeus (aka deadline). It's a hardware interface, gcc based toolchain and software bootloader for the OutRun boardset. It allows you to upload and execute C or assembly based software on the original hardware.



The Hardware

The connecting hardware is veroboard/prototyping board based, and uses simple TTL buffers/inverters (74HCT04). The interface partially implements the IEEE1284 spec as the basis for communication. The hardware utilises the unused digital input pins on the port that has the start and coin inputs. There are 16 in total, and these can be read as is done in the game. Output is achieved through bits connected to the start light, brake light and external mute. 



The Bootloader

The bootloader is coded in 68000 assembly and must be programmed to the master CPU eproms. It implements the protocol without using any RAM (not even the stack), so that everything can be overwritten by the uploaded code. It also forwards interrupts from ROM to the same locations in RAM, so it's transparent to build binaries for uploading or plain eprom images. The interface only supports uploading code into RAM so it's limited to 2x32kb banks, minus the actual memory one would need. So uploading a complete outrun image would be impossible. But splitting the data (if there is any) and keeping that in the upper 2x256kb of ROM would be feasible.


The Toolchain

The toolchain consists of cross-gcc (C only), some linker scripts and a basic supporting library. The bootloader source code offers a nice example of how to code a basic program to run on the hardware. 


Some videos of the setup can be found here and hereAlex plans to release the package including schematics and source code at some point soon. Then we can have an oldskool demo coding competition or similar! 

Saturday, November 17, 2012

Sega System 16 Sprite Viewer

Edit: These instructions are now dated, but please follow the link below for the latest version and instructions.

Here's a quick and dirty tool to view sprites stored in Sega's System 16 format. I searched for something similar, but couldn't find anything, so coded my own.


To use the tool, you will need to place the appropriate sprite files in the roms subdirectory.

The easiest way to determine which rom filenames you require, is to look at the relevant MAME driver file. Here are some links:


Find the section where the sprites are loaded. You must load the files in blocks of four. Some games have multiple banks of sprites. Here's an example for OutRun:


For example, in this case, to load the first batch of sprites you would run the tool as follows:
s16GfxViewer mpr-10371.9 mpr-10373.10 mpr-10375.11 mpr-10377.12

And for the second sprite bank:
s16GfxViewer mpr-10372.13 mpr-10374.14 mpr-10376.15 mpr-10378.16

One thing to note is that the sprite data does not contain palette information. By default the tool displays the files using a pseudo-greyscale palette. 

However, for OutRun I've extracted the sprite palettes from the 68000 program files. And you can toggle through all 255 palettes by using cursor left and cursor right. Unfortunately, there is no automatic way of determining which palette goes with which sprite. This information is hardcoded by the game at runtime. Some sprites can use more than one palette. 

One cool use for this tool will be to search for unused graphics in Sega titles. Please comment below and post a screenshot if you find any.  For example, here is an unused start banner from OutRun that is revealed by palette switching (using palettes 41 and 42):



I will be posting the source code to this tool when I release the Cannonball source code before the end of the year. Maybe someone wants to have a go at locating and including the other palettes. 


Page Up/Page Down: Scroll Page
Cursor Up/Cursor Down: Fine Scroll
Cursor Left/Cursor Right: Change Palette (OutRun palettes only) 
Space: Save a BMP

Monday, November 12, 2012

Power Drift Easter Egg

Ding Ding Round Two! This time, we're pulling Power Drift apart. A crazy game, with some amusing secret messages, that I don't think have ever been revealed.... After 20 years, it's surely time to see what the developers were smoking.


As I realised during my OutRun work, AM2's titles contain weird and wonderful content. Power Drift it no exception, and I soon found text about elephants and various smells by examining the memory in MAME.


Then it was a case of tracing through tons of code to figure out how it was used. To complicate matters, there was a nasty red herring. If you enter SEX on the high-score table, you will see the message DANGER DANGER!




I thought I'd solved the puzzle, as searching for the string 'SEX' in memory revealed the following location:


You'll notice that the first three characters spell SEX, followed by various other letters. I recognised some of these initials as belonging to the AM2 development team, so I presumed entering the other names would invoke the other messages. Unfortunately, this wasn't quite correct. The fragment of code I'd uncovered that used the above table didn't seem to be called when I entered a name. 

Instead, I found a manual check against 'SEX' hard coded elsewhere. Here is some of my commented disassembly: 


What was going on? By examining the code, I realised that if you held BRAKE and pressed START when entering a special name, a separate function would execute. Bingo, this was the section that read the larger initial table. And now, we can display messages regarding elephants written in somewhat dubious English:


Not only that, but for each special name entered, you generally receive a different message dependent on which gear you are in. Here are some others, that amused me:



Well, finding other messages becomes easier when you've decompiled the code. A summary of the messages follows :)

When Brake & Start Button Depressed:
SEX: DANGER !! DANGER !!

When Brake & Start Button Pressed (Select one of two messages with gear):
SEX:  LAKE YOU ? ME TOO ! & MACHINE T.K.G.!!
KEY: I LOVE MAKIKO. & I LOVE CYNDI.
TKG:  I LOVE RAY CHAN. & I LOVE RIE CHAN.
GAK: SAKICHI !! KITARO !! & I LOVE CHISAKI !
OKA: I AM TALLER THAN T.K.G. ! & KIM SAN ISSHOU TUITE IKIMASU.
REE: HALLO !! LETS FIND ANOTHER MESSAGES. & ARE YOU M2C2 MENBER?
NAK: NIGASITA SAKANA WA DECOI.
AKI: LUCY IS MINE! & EMILY IS MINE!
MAT: DO YOU KNOW ELEPHANT SMELL??
SAD: I LOVE KAYURI CHINA & NS400 IS FARSTEST BIKE IN THE WORLD.
HIR: MUSIC DESIGN BY HIRO. & SOUND DESIGN BY MY DESHI.

Saturday, November 10, 2012

Afterburner Easter Egg (Dev Credits)

Today I decompiled a portion of Afterburner II's code to investigate some unused developer text I found in the ROM.


I traced the usage of these strings back through the code, with some manual IDA work. In the end I landed on the following function which enables the related block of code:


This revealed that the text could be triggered on the Continue Play screen, providing the player hadn't already inserted a coin.  On this screen you must press the cannon button (fire 1) four times, the missile button (fire 2) twice, followed by the cannon button again. 

On inserting a coin and resuming the game, a (c) SEGA 1987 message will now be shown:

Message 1: (c) SEGA 1987

But what of the other text strings? Unfortunately, it appears that you can only display them using the Mame debugger. The routine to display them is present in the code, but the counter to select the message (which should increment each time you do the cheat), is broken as it resets when the Continue Play screen initializes. I think the original intention was to cycle the message each time the player entered the cheat code, but for whatever reason that never happened. 

You can manually set the counter (0x3F9126) to override this behaviour. Let's take a look: 

Message 2: Presented By Sega

Message 3: I Love Momoko

Message 4: Programmer Credits

What's interesting is Satoshi Mifune's name appears in the credits here, who later programmed titles including Shenmue and Virtual Striker. It's very difficult to find out the dev team members of these early AM2 titles, so great to have this proven. I wonder who Momoko was... 

I also investigated Afterburner I. It contains a similar routine, but is tougher to activate. This is because after pressing fire1 x4 and fire2 x2, you must almost simultaneously coin-up and start.

Monday, November 05, 2012

Gamest Issue 4 - November 1986

Check out this issue of the Japanese magazine Gamest, that covers the 1986 Amusement Machine (AM) show, where Sega previewed OutRun. Gamest is an amazing publication although it would be even better if I understood Japanese.

I've scanned the colour pages relating to OutRun below. I love the cover advert; it's similar in style to the Japanese flyer. Click the images for a full-size version.



Wednesday, October 31, 2012

Sounding Off

I'm currently implementing sound in Cannonball (the name for the cross platform OutRun engine). Much like my approach to the video hardware, the sound hardware will be emulated, whilst the actual Z80 program code is converted to readable C++.

I've implemented the SDL sound layer to output the audio, hooked up emulation of the Sega PCM chip and created the interface between the main program code and sound code. I've successfully converted enough of the Z80 code to trigger basic PCM samples. The entire Z80 rom is decompiled and commented, so progress from here should be steady.

There will (eventually) be two approaches to audio in Cannonball. The first approach will purely use the original ROMs for music and sound as discussed above. The second approach will allow players to configure audio files as replacement music tracks. This will allow you to play the game with the various remixes that have been produced over the years.

Once sound is implemented, I'll open up the source code repository to public access. This will allow everyone to play with and port the source code to new platforms for non-commercial purposes.

Saturday, October 20, 2012

Z80 Program Code - Part 2

Let's take a look at the structured format of sound information. Here's a relatively straightforward example demonstrating the setup of the Checkpoint PCM sample.

; Voice 1, Checkpoint
ROM:6F91 data_voice1:    dw data_voice1_c   ; Offset to channel setup below

The sample is played through two channels simultaneously, presumably to boost its volume. 

; Voice 1, Channel Setup
ROM:6F99 data_voice1_c:  db 2               ; Number of channels
ROM:6F9A                 dw data_voice1_c1  ; Address of Channel 1 Setup
ROM:6F9C                 dw data_voice1_c2  ; Address of Channel 2 Setup

This block represents the default setup for the 32 byte block mentioned in the previous post. It's not actually 32 bytes, but the remainder of the space is padding to zero by the program code. I've cut the second entry short in the interests of space as it's very similar.

; Voice 1, Checkpoint (PCM Samples: Channel 1) - Default 0x20 area setup
ROM:6F9E data_voice1_c1: db 80h             ; Flags: Enable
ROM:6F9F                 db 1000110b        ; Flags: Mute & Channel Index
ROM:6FA0                 db 2               ; End Marker
ROM:6FA1                 dw 0
ROM:6FA3                 dw 1
ROM:6FA5                 dw data_voice1_c1p; Address of commands
ROM:6FA7                 db 0
ROM:6FA8                 db 20h            ; Offset for positioning information
ROM:6FA9                 db 0
ROM:6FAA                 db 0
ROM:6FAB                 db 0

; Voice 1, Checkpoint (PCM Samples: Channel 2)
ROM:6FAC data_voice1_c2: db 80h
; Snip: Similar to the above block
ROM:6FB9                 db 0

Here's where things gets a little interesting; what follows is a series of commands that correspond to a particular z80 routine, along with their arguments.

; Voice 1, Checkpoint (PCM Properties)
ROM:6FBA data_voice1_c1p:db 93             ; 93 = Command: PCM Set Pitch
ROM:6FBB                 db 48h            ;    value = pitch
ROM:6FBC                 db 82h            ; 82 = Command: PCM Sample Volumes
ROM:6FBD                 db 17h            ;    value = left channel vol
ROM:6FBE                 db 2Eh            ;    value = right channel vol
ROM:6FBF                 db 0DCh           ; DC = Command: Sample Index
ROM:6FC0                 db 28h            ;    value = checkpoint
ROM:6FC1                 db 99h            ; 99 = Command: PCM Finalize

ROM:6FC2 data_voice1_c2p:db 93h            ; 93 = Command: PCM Set Pitch
ROM:6FC3                 db 48h            ;    value = pitch
ROM:6FC4                 db 82h            ; 82 = Command: PCM Sample Volumes
ROM:6FC5                 db 2Eh            ;    value = left channel vol
ROM:6FC6                 db 17h            ;    value = right channel vol
ROM:6FC7                 db 0DCh           ; DC = Command: Sample Index
ROM:6FC8                 db 28h            ;    value = checkpoint
ROM:6FC9                 db 99h            ; 99 = Command: PCM Finalize

These commands index a table of routines which is as follows. Not all of these routines are used, as I imagine this area of the code is used across other Sega titles. I've highlighted in red the entries used by the above sample.

ROM:0B93 BigRoutineTable:
ROM:0B93    dw YM_Dec_Pos           ; YM: Decrement Position In Sequence (80)
ROM:0B95    dw YM_SetEndMarker      ; YM: Set End Marker. 
ROM:0B97    dw PCM_SetVol           ; PCM: Set Volume (Left & Right Channels) (82)
ROM:0B99    dw YM_Dec_Pos           ; YM: Decrement Position In Sequence (80)
ROM:0B9B    dw YM_Finalize          ; YM: End (84)
ROM:0B9D    dw YM_SetNoise          ; YM: Enable Noise Channel (85)
ROM:0B9F    dw loc_409              ; Unused?
ROM:0BA1    dw YM_SetModTab         ; YM: Enable/Disable Modulation table
ROM:0BA3    dw WriteSeqAddr
ROM:0BA5    dw SetSeqAddr           ; Set Next Sequence Address
ROM:0BA7    dw YM_GetLoopAdr        ; de = new YM loop address
ROM:0BA9    dw YM_SetNoteOffset     ; YM: Set Note/Octave Offset (8B)
ROM:0BAB    dw YM_DoLoop            ; YM: Loop Sequence Of Commands (8C)
ROM:0BAD    dw loc_46B              ; Unused?
ROM:0BAF    dw loc_471              ; Unused?
ROM:0BB1    dw YM_Enable_Correspnd  ; YM: (Unused) Enable corresponding channel (8F)
ROM:0BB3    dw YM_Disable_Correspnd ; YM: (Unused) Disable corresponding channel (90)
ROM:0BB5    dw YM_SetBlock          ; YM: Set Block - Called First When Setting Up (91)
ROM:0BB7    dw YM_DisableNoise      ; YM: Disable Noise Channel (92)
ROM:0BB9    dw PCM_SetPitch         ; PCM: Set Pitch (93)
ROM:0BBB    dw YM_MarkerData        ; FM: End Marker - Do not calculate, use value from data (94)
ROM:0BBD    dw YM_MarkerHigh        ; FM: End Marker - Set High Byte From Data (95)
ROM:0BBF    dw YM_ConnectRight      ; FM: Connect Channel to Right Speaker (96)
ROM:0BC1    dw YM_ConnectLeft       ; FM: Connect Channel to Left Speaker (97)
ROM:0BC3    dw YM_ConnectCentre     ; FM: Connect Channel to Both Speaker (98)
ROM:0BC5    dw PCM_Finalize         ; Write Commands to PCM Channel (99)

In case you were wondering the 0xDC command which is not shown in the table above triggers a separate piece of code, which also triggers drum samples and so forth in the music tracks. Anyway,  let's take a look at a simple routine - setting the pitch of a PCM sample.

ROM:03C4 PCM_SetPitch:
ROM:03C4   bit     6, (ix+1)       ; If channel is muted, don't set pitch
ROM:03C8   jp      nz, set_pitch
ROM:03CB   ld      a, a
ROM:03CC   ret
ROM:03CD set_pitch:
ROM:03CD   ld      a, (de)         ; a = New pitch (read from setup table in rom)
ROM:03CE   ld      (ix+16h), a     ; Set relevant area in 32 byte block that controls pitch
ROM:03D1   ret

The music tracks work in a similar way, but with a much longer and more complex series of commands.

Originally, I thought the Z80 might be used in a 'dumb' manner and simply stream preformatted audio data to the various chips. But its usage is much more sophisticated as demonstrated above.

Thursday, October 18, 2012

Z80 Program Code - Part 1

I've almost finished decompiling OutRun's Z80 program code, so I'll be providing high level information regarding its workings over a series of posts.

The Z80 processor controls two pieces of sound hardware; a custom Sega PCM controller and a Yamaha YM2151 FM sound chip. This was a fairly standard configuration for Sega boardsets at the time. As you'd expect, some of the Z80 program code is in fact shared with other games of the era. However, most of the code is unique and written solely with OutRun in mind.

Commands are sent to the Z80 from the master 68000 program code. The Z80's interrupt routine reads from port 0x40 and places the values received into a sequential set of locations in RAM. Commands are high level and consist of a byte corresponding to a Z80 routine. So sending 0x81 plays the 'Passing Breeze' music, whereas 0x9d triggers the 'Checkpoint' PCM sample. From the 68000's point of view, playing a sound is simple and the complexity is nicely masked.

In addition to these commands, the 68000 sends data relating to the volume and pitch of the Ferrari's engine tone. It also sends volume and panning information relating to the passing traffic. This ensures that when you drive past a vehicle, the volume of its engine is proportional to the y distance from your Ferrari and the stereo panning corresponds to the x difference.

The core loop to achieve everything is as follows:

ROM:0039 main_loop:
ROM:0039   call    DoFMTimerA      ; Wait for timer on YM2151 chip 
ROM:003C   call    ProcessCommand  ; Process Command sent by 68000
ROM:003F   call    ProcessChannels ; Run logic on individual sound channel (both YM & PCM channels)
ROM:0042   call    ProcessEngines  ; Ferrari Engine Tone & Traffic Noise
ROM:0045   call    ProcessTraffic  ; Traffic Volume, Panning, Pitch
ROM:0048   jp      main_loop

The Z80 maps the 16 channels of the PCM chip to various uses. 6 are reserved for the music's drum samples, 4 are used for sampled sound effects and the remainder are used for the Ferrari's engine sound and passing traffic. Each channel is allocated a 32 byte area of RAM by the Z80 program code, which stores its current state. This concept is extended to include the channels from the YM chip which are also allocated to these areas of RAM.

The usage of the 32 byte area of RAM differs dependent on whether it represents a YM or PCM channel. The area contains everything from basics including volume and pitch for PCM samples through to complex YM configuration including positional information within the current block of audio commands, section loop counters and the address of the next data block. This 32 byte block is used as a starting point to configure the separate PCM RAM area, which has a different format and to program the YM's registers.

Next time, I'll explain the interpreted language stored within the Z80 code. This is used by the Z80 to program the sound hardware. And you'll see how the music and sound effects are actually stored as an interpreted sequence of commands that call functions within the code.

Monday, September 24, 2012

Raspberry Pi Progress

Here's a screenshot of the OutRun engine running on a Raspberry Pi. The display is being output on X11 via SSH. It hasn't been tried on the native Pi display yet. 


I've decided to name the OutRun engine Cannonball, after the 1981 Cannonball Run film that Yu Suzuki was inspired by. 

Friday, September 07, 2012

Cross Platform Support

Thanks to everyone who tried the recent Visual Studio based build for Windows. The plan is to ensure this becomes a true cross platform project, not tied to a particular operating system or architecture. I like to think of it as "OutRun Everywhere", making the world a better place ;) Thanks to some work from a friend, who knows far more about this sort of thing than me, this is close to becoming a reality.

The code now successfully compiles and runs on both a Mac with XCode IDE support and the Windows MinGW compiler. Other platforms will shortly follow, including Linux and the Raspberry PI if performance allows.

We're using CMake, the cross platform, open-source build system. This automates the creation of build files for a whole range of target platforms. We're able to generate builds for a whole host of platforms and configurations.

The C++ libraries have been switched to Boost. This provides an open-source cross platform alternative to facilitate portability.

I can't take credit for the above, but I have started decompilation work on the Z80 code that controls the sound hardware (both the custom Sega PCM sample player and the Yamaha YM2151). This is my main area of focus and will take some time. So far, I've commented the code that triggers the PCM samples. Ultimately, I'd love to give players the choice of emulating the original sound hardware or streaming audio from disk, similar to the approach used by the Sega Saturn conversion.

Monday, August 27, 2012

OutRun C++ Engine Tech Demo 2

At last, here's a new demo of the OutRun engine. The entire game is ported, aside from sound and the service mode.

In terms of functionality, this release is bare bones. There is no menu system yet, all options are hardcoded and you have to play the game windowed.

It would be great if you could report bugs (and I'm sure there will be plenty) in the comments below. Please verify any subtleties against MAME for reference.


Stats:

  • Conversion time from decompiled code: 1 year 10 months.
  • Estimated ratio of time spent coding vs. debugging: 1:5
  • Road rendering code: 1500 lines
  • Ferrari handling & rendering: 1680 lines
  • Code to render level objects: 1050 lines
  • General sprite handling code: 890 lines
  • Traffic handling code: 675 lines
  • Code to handle crash routines: 1450 lines

Keys:

  • Cursors: Steering
  • Z: Accelerate
  • X: Brake
  • Space: Gear Change
  • 5: Insert Coin
  • 1: Start
  • F1: Pause
  • F2: Advance a frame when paused (useful for observing visual problems)
  • F3: Toggle/Freeze timers. (i.e. infinite time)
In a future revision, there will be options to custom the controls and the analogue sensitivity. I find MAME's default setup too twitchy, so you'll find the steering a little more heavy in comparison. 


Enhancements over original:

In a future revision, enhancements will be optional and there will be a menu toggle to enable/disable them.


Requirements:


Download:

Thursday, August 23, 2012

End Sequence Bugs

Here's another bug in the original game; the leftmost two end sequences have a palette issue which causes the male sprite to suddenly change in appearance. In the screenshot below, we're approaching the goal banner.


Then, as if by magic, the colour of the man's top changes to light blue!


But don't worry, on reaching the finish line it's back to dark blue again. 


The game code swaps to an animation playing routine at the point of the colour change. It should be seamless. But it seems as if 2 of the 5 end routines are configured incorrectly. 

Why am I noticing such trivial details? Because the engine is now complete (minus sound and test mode). Expect a test release in the next week! 

In other news, I updated the Philko bootleg page with some new pictures.