Giter Club home page Giter Club logo

another-world-bytecode-interpreter's Issues

_memList array should be dinamically allocated

Currently we have an arbitrary number of 150 memory entries hardcoded in resource.h

Ideally we should parse MEMLIST.BIN once to figure out the ammount of resources, dinamically allocate the ammount of memory needed for the array and then re-parse the MEMLIST.BIN file to populate the _memList array.

happy hacking,
Felipe "Juca" Sanches

Strings shouldnt be hardcoded in the game-engine

The drawstrings opcode receives a string id and then reads it from a list of hardcoded strings in the interpreter. I think that the strings should be fetched as game resources somehow. Any idea how was that done in the original game?

error compiling

make
g++ -Os -g -std=gnu++98 -fno-rtti -fno-exceptions -Wall -Wno-unknown-pragmas -Wshadow -Wundef -Wwrite-strings -Wnon-virtual-dtor -Wno-multichar sdl2-config --cflags -DAUTO_DETECT_PLATFORM -MMD -c bank.cpp -o bank.o
g++ -Os -g -std=gnu++98 -fno-rtti -fno-exceptions -Wall -Wno-unknown-pragmas -Wshadow -Wundef -Wwrite-strings -Wnon-virtual-dtor -Wno-multichar sdl2-config --cflags -DAUTO_DETECT_PLATFORM -MMD -c file.cpp -o file.o
g++ -Os -g -std=gnu++98 -fno-rtti -fno-exceptions -Wall -Wno-unknown-pragmas -Wshadow -Wundef -Wwrite-strings -Wnon-virtual-dtor -Wno-multichar sdl2-config --cflags -DAUTO_DETECT_PLATFORM -MMD -c engine.cpp -o engine.o
g++ -Os -g -std=gnu++98 -fno-rtti -fno-exceptions -Wall -Wno-unknown-pragmas -Wshadow -Wundef -Wwrite-strings -Wnon-virtual-dtor -Wno-multichar sdl2-config --cflags -DAUTO_DETECT_PLATFORM -MMD -c mixer.cpp -o mixer.o
g++ -Os -g -std=gnu++98 -fno-rtti -fno-exceptions -Wall -Wno-unknown-pragmas -Wshadow -Wundef -Wwrite-strings -Wnon-virtual-dtor -Wno-multichar sdl2-config --cflags -DAUTO_DETECT_PLATFORM -MMD -c resource.cpp -o resource.o
g++ -Os -g -std=gnu++98 -fno-rtti -fno-exceptions -Wall -Wno-unknown-pragmas -Wshadow -Wundef -Wwrite-strings -Wnon-virtual-dtor -Wno-multichar sdl2-config --cflags -DAUTO_DETECT_PLATFORM -MMD -c parts.cpp -o parts.o
g++ -Os -g -std=gnu++98 -fno-rtti -fno-exceptions -Wall -Wno-unknown-pragmas -Wshadow -Wundef -Wwrite-strings -Wnon-virtual-dtor -Wno-multichar sdl2-config --cflags -DAUTO_DETECT_PLATFORM -MMD -c vm.cpp -o vm.o
g++ -Os -g -std=gnu++98 -fno-rtti -fno-exceptions -Wall -Wno-unknown-pragmas -Wshadow -Wundef -Wwrite-strings -Wnon-virtual-dtor -Wno-multichar sdl2-config --cflags -DAUTO_DETECT_PLATFORM -MMD -c serializer.cpp -o serializer.o
g++ -Os -g -std=gnu++98 -fno-rtti -fno-exceptions -Wall -Wno-unknown-pragmas -Wshadow -Wundef -Wwrite-strings -Wnon-virtual-dtor -Wno-multichar sdl2-config --cflags -DAUTO_DETECT_PLATFORM -MMD -c sfxplayer.cpp -o sfxplayer.o
sfxplayer.cpp: In constructor ‘SfxPlayer::SfxPlayer(Mixer*, Resource*, System*)’:
sfxplayer.cpp:26:61: warning: declaration of ‘res’ shadows a member of ‘SfxPlayer’ [-Wshadow]
SfxPlayer::SfxPlayer(Mixer *mix, Resource *res, System stub)
^
In file included from sfxplayer.cpp:19:0:
sfxplayer.h:57:12: note: shadowed declaration is here
Resource res;
^~~
g++ -Os -g -std=gnu++98 -fno-rtti -fno-exceptions -Wall -Wno-unknown-pragmas -Wshadow -Wundef -Wwrite-strings -Wnon-virtual-dtor -Wno-multichar sdl2-config --cflags -DAUTO_DETECT_PLATFORM -MMD -c staticres.cpp -o staticres.o
g++ -Os -g -std=gnu++98 -fno-rtti -fno-exceptions -Wall -Wno-unknown-pragmas -Wshadow -Wundef -Wwrite-strings -Wnon-virtual-dtor -Wno-multichar sdl2-config --cflags -DAUTO_DETECT_PLATFORM -MMD -c util.cpp -o util.o
g++ -Os -g -std=gnu++98 -fno-rtti -fno-exceptions -Wall -Wno-unknown-pragmas -Wshadow -Wundef -Wwrite-strings -Wnon-virtual-dtor -Wno-multichar sdl2-config --cflags -DAUTO_DETECT_PLATFORM -MMD -c video.cpp -o video.o
g++ -Os -g -std=gnu++98 -fno-rtti -fno-exceptions -Wall -Wno-unknown-pragmas -Wshadow -Wundef -Wwrite-strings -Wnon-virtual-dtor -Wno-multichar sdl2-config --cflags -DAUTO_DETECT_PLATFORM -MMD -c main.cpp -o main.o
g++ -Os -g -std=gnu++98 -fno-rtti -fno-exceptions -Wall -Wno-unknown-pragmas -Wshadow -Wundef -Wwrite-strings -Wnon-virtual-dtor -Wno-multichar sdl2-config --cflags -DAUTO_DETECT_PLATFORM -MMD -c sysImplementation.cpp -o sysImplementation.o
sysImplementation.cpp:304:1: warning: identifier ‘nullptr’ is a keyword in C++11 [-Wc++11-compat]
return nullptr;
^~~~~~
sysImplementation.cpp: In member function ‘virtual void
SDLStub::addTimer(uint32_t, System::TimerCallback, void
)’:
sysImplementation.cpp:304:8: error: ‘nullptr’ was not declared in this scope
return nullptr;
^~~~~~~
Makefile:26: recipe for target 'sysImplementation.o' failed
make: *** [sysImplementation.o] Error 1

How to dump/encode bytecode ?

I'd like to take a look at the bytecode source code. Is there a way to dump the bytecode resources to a set of text files?

Another cool tool would be a compiler that would get bytecode sources and encode them and save them as resources in a BANK file.

done!

this issue have been done!

Crash on OpenBSD/amd64

Fix (sry, no idea how to use this freaking git in proper way):

diff --git a/resource.cpp b/resource.cpp
index 33c9da1..2dae433 100644
--- a/resource.cpp
+++ b/resource.cpp
@@ -95,6 +95,9 @@ void Resource::readEntries() {
                memEntry->unk10 = f.readUint16BE();
                memEntry->size = f.readUint16BE();

+               if (memEntry->type > STATS_TOTAL_SIZE)
+                       break;
+
                //Memory tracking
                if (memEntry->packedSize==memEntry->size)
                {

game hangs under linux while opening audio

SDL_OpenAudio will hang under linux with pulseaudio when AUDIO_S8 is passed as the format. See this SDL bug I opened for reference (although it seems unlikely to be fixed in 1.2.x): http://bugzilla.libsdl.org/show_bug.cgi?id=1283

If I change the format to AUDIO_U8 the game can run successfully but the audio predictably sounds bad. This could be solved by using a hook to the audio which simple adds 0x8000 thus converting between S8 to U8, but would have to be done on all platforms (unless #ifdef magic is ok, but I would rather avoid that).

Doesnt work for me on Windows 7

I built from source with VS2013 under Windows 7(64Bit) and it doesn't work. The error message is:
"
R:0x00, RT_SOUND size= 0 (compacted gain= 0%)
R:0x01, RT_SOUND size= 6716 (compacted gain= 8%)
R:0x02, RT_SOUND size=11828 (compacted gain=22%)
R:0x03, RT_SOUND size=27128 (compacted gain=28%)
R:0x04, RT_SOUND size=17870 (compacted gain= 4%)
R:0x05, RT_SOUND size= 3834 (compacted gain= 0%)
R:0x06, RT_SOUND size= 3366 (compacted gain=50%)
R:0x07, RT_MUSIC size=15552 (compacted gain=92%)
R:0x08, RT_SOUND size= 9844 (compacted gain=48%)
R:0x09, RT_SOUND size=11190 (compacted gain= 0%)
R:0x0A, RT_SOUND size=11188 (compacted gain= 4%)
R:0x0B, RT_SOUND size= 1062 (compacted gain=30%)
R:0x0C, RT_SOUND size= 6226 (compacted gain= 2%)
R:0x0D, RT_SOUND size= 1428 (compacted gain= 0%)
R:0x0E, RT_SOUND size= 5104 (compacted gain=12%)
R:0x0F, RT_SOUND size= 1950 (compacted gain=19%)
R:0x10, RT_SOUND size=22178 (compacted gain=44%)
R:0x11, RT_UNKNOWN size=25108 (compacted gain=25%)
R:0x12, RT_POLY_ANIM size=32000 (compacted gain=71%)
R:0x13, RT_POLY_ANIM size=32000 (compacted gain=82%)
R:0x14, RT_PALETTE size= 2048 (compacted gain=59%)
R:0x15, RT_BYTECODE size= 4321 (compacted gain=23%)
R:0x16, RT_POLY_CINEMATIC size= 5124 (compacted gain=38%)
R:0x17, RT_PALETTE size= 2048 (compacted gain=35%)
R:0x18, RT_BYTECODE size= 9871 (compacted gain=25%)
R:0x19, RT_POLY_CINEMATIC size=65230 (compacted gain=15%)
R:0x1A, RT_PALETTE size= 2048 (compacted gain=40%)
R:0x1B, RT_BYTECODE size=20810 (compacted gain=34%)
R:0x1C, RT_POLY_CINEMATIC size=57510 (compacted gain=22%)
R:0x1D, RT_PALETTE size= 2048 (compacted gain=33%)
R:0x1E, RT_BYTECODE size=39695 (compacted gain=35%)
R:0x1F, RT_POLY_CINEMATIC size=53720 (compacted gain=22%)
R:0x20, RT_PALETTE size= 2048 (compacted gain=42%)
R:0x21, RT_BYTECODE size=62683 (compacted gain=34%)
R:0x22, RT_POLY_CINEMATIC size=65132 (compacted gain=19%)
R:0x23, RT_PALETTE size= 2048 (compacted gain=38%)
R:0x24, RT_BYTECODE size= 8287 (compacted gain=27%)
R:0x25, RT_POLY_CINEMATIC size=29212 (compacted gain=22%)
R:0x26, RT_PALETTE size= 2048 (compacted gain=36%)
R:0x27, RT_BYTECODE size=50736 (compacted gain=35%)
R:0x28, RT_POLY_CINEMATIC size=64958 (compacted gain=21%)
R:0x29, RT_PALETTE size= 2048 (compacted gain=40%)
R:0x2A, RT_BYTECODE size= 2886 (compacted gain=28%)
R:0x2B, RT_POLY_CINEMATIC size=20026 (compacted gain=24%)
R:0x2C, RT_SOUND size= 882 (compacted gain= 0%)
R:0x2D, RT_SOUND size= 7684 (compacted gain= 0%)
R:0x2E, RT_SOUND size= 2282 (compacted gain=13%)
R:0x2F, RT_SOUND size= 6726 (compacted gain= 4%)
R:0x30, RT_SOUND size=13374 (compacted gain= 7%)
R:0x31, RT_SOUND size= 5278 (compacted gain=17%)
R:0x32, RT_SOUND size= 6246 (compacted gain=34%)
R:0x33, RT_SOUND size= 614 (compacted gain= 9%)
R:0x34, RT_SOUND size= 0 (compacted gain= 0%)
R:0x35, RT_SOUND size= 424 (compacted gain= 1%)
R:0x36, RT_SOUND size= 8172 (compacted gain=36%)
R:0x37, RT_SOUND size= 5028 (compacted gain=33%)
R:0x38, RT_SOUND size= 5572 (compacted gain=20%)
R:0x39, RT_SOUND size= 3626 (compacted gain= 7%)
R:0x3A, RT_SOUND size= 870 (compacted gain=17%)
R:0x3B, RT_SOUND size= 120 (compacted gain= 0%)
R:0x3C, RT_SOUND size= 5010 (compacted gain=19%)
R:0x3D, RT_SOUND size= 1760 (compacted gain=16%)
R:0x3E, RT_SOUND size= 8622 (compacted gain= 9%)
R:0x3F, RT_SOUND size= 1274 (compacted gain= 1%)
R:0x40, RT_SOUND size= 4766 (compacted gain=17%)
R:0x41, RT_SOUND size= 2484 (compacted gain=22%)
R:0x42, RT_SOUND size= 1260 (compacted gain=10%)
R:0x43, RT_POLY_ANIM size=32000 (compacted gain=67%)
R:0x44, RT_POLY_ANIM size=32000 (compacted gain=77%)
R:0x45, RT_POLY_ANIM size=32000 (compacted gain=75%)
R:0x46, RT_POLY_ANIM size=32000 (compacted gain=72%)
R:0x47, RT_POLY_ANIM size=32000 (compacted gain=97%)
R:0x48, RT_POLY_ANIM size=32000 (compacted gain=63%)
R:0x49, RT_POLY_ANIM size=32000 (compacted gain=62%)
R:0x4A, RT_SOUND size= 960 (compacted gain=11%)
R:0x4B, RT_SOUND size= 5094 (compacted gain= 9%)
R:0x4C, RT_SOUND size= 1246 (compacted gain=20%)
R:0x4D, RT_SOUND size= 1530 (compacted gain=10%)
R:0x4E, RT_SOUND size= 606 (compacted gain= 8%)
R:0x4F, RT_SOUND size= 1602 (compacted gain= 1%)
R:0x50, RT_SOUND size= 6608 (compacted gain=39%)
R:0x51, RT_SOUND size= 232 (compacted gain=12%)
R:0x52, RT_SOUND size= 4130 (compacted gain=16%)
R:0x53, RT_POLY_ANIM size=32000 (compacted gain=79%)
R:0x54, RT_SOUND size=22698 (compacted gain=22%)
R:0x55, RT_SOUND size= 2448 (compacted gain=39%)
R:0x56, RT_SOUND size=11330 (compacted gain=11%)
R:0x57, RT_SOUND size= 5420 (compacted gain= 0%)
R:0x58, RT_SOUND size= 1460 (compacted gain= 0%)
R:0x59, RT_SOUND size= 9140 (compacted gain=48%)
R:0x5A, RT_SOUND size= 8100 (compacted gain=21%)
R:0x5B, RT_SOUND size= 3360 (compacted gain=31%)
R:0x5C, RT_SOUND size= 1320 (compacted gain= 0%)
R:0x5D, RT_SOUND size= 5640 (compacted gain=17%)
R:0x5E, RT_SOUND size= 490 (compacted gain= 8%)
R:0x5F, RT_SOUND size= 2026 (compacted gain= 0%)
R:0x60, RT_SOUND size= 232 (compacted gain=12%)
R:0x61, RT_SOUND size=14712 (compacted gain=21%)
R:0x62, RT_SOUND size= 4472 (compacted gain=14%)
R:0x63, RT_SOUND size= 5296 (compacted gain=23%)
R:0x64, RT_SOUND size= 2724 (compacted gain= 0%)
R:0x65, RT_SOUND size= 730 (compacted gain=24%)
R:0x66, RT_SOUND size= 9844 (compacted gain=48%)
R:0x67, RT_SOUND size= 4848 (compacted gain= 0%)
R:0x68, RT_SOUND size=23896 (compacted gain=32%)
R:0x69, RT_SOUND size=41506 (compacted gain=25%)
R:0x6A, RT_SOUND size=11880 (compacted gain= 0%)
R:0x6B, RT_SOUND size=20934 (compacted gain=15%)
R:0x6C, RT_SOUND size= 5094 (compacted gain= 9%)
R:0x6D, RT_SOUND size= 5278 (compacted gain=17%)
R:0x6E, RT_SOUND size=22698 (compacted gain=22%)
R:0x6F, RT_SOUND size=17500 (compacted gain= 0%)
R:0x70, RT_SOUND size= 3472 (compacted gain= 7%)
R:0x71, RT_SOUND size= 2532 (compacted gain=18%)
R:0x72, RT_SOUND size= 6538 (compacted gain=19%)
R:0x73, RT_SOUND size= 9682 (compacted gain=22%)
R:0x74, RT_SOUND size= 9264 (compacted gain= 0%)
R:0x75, RT_SOUND size= 4886 (compacted gain= 0%)
R:0x76, RT_SOUND size= 544 (compacted gain=15%)
R:0x77, RT_SOUND size= 1514 (compacted gain=20%)
R:0x78, RT_SOUND size= 1084 (compacted gain=13%)
R:0x79, RT_SOUND size= 2282 (compacted gain=13%)
R:0x7A, RT_SOUND size= 5240 (compacted gain= 7%)
R:0x7B, RT_SOUND size=17198 (compacted gain= 0%)
R:0x7C, RT_SOUND size= 1742 (compacted gain=30%)
R:0x7D, RT_PALETTE size= 2048 (compacted gain=38%)
R:0x7E, RT_BYTECODE size= 4257 (compacted gain=27%)
R:0x7F, RT_POLY_CINEMATIC size= 5048 (compacted gain=40%)
R:0x80, RT_SOUND size= 6298 (compacted gain= 9%)
R:0x81, RT_SOUND size= 2008 (compacted gain= 0%)
R:0x82, RT_SOUND size= 1122 (compacted gain=17%)
R:0x83, RT_SOUND size= 4008 (compacted gain= 0%)
R:0x84, RT_SOUND size=26414 (compacted gain= 0%)
R:0x85, RT_SOUND size= 0 (compacted gain= 0%)
R:0x86, RT_SOUND size= 0 (compacted gain= 0%)
R:0x87, RT_SOUND size= 0 (compacted gain= 0%)
R:0x88, RT_SOUND size= 9340 (compacted gain=18%)
R:0x89, RT_MUSIC size= 2240 (compacted gain=94%)
R:0x8A, RT_MUSIC size=15552 (compacted gain=86%)
R:0x8B, RT_SOUND size=20314 (compacted gain= 0%)
R:0x8C, RT_SOUND size=17432 (compacted gain=22%)
R:0x8D, RT_SOUND size=10556 (compacted gain= 3%)
R:0x8E, RT_SOUND size=16328 (compacted gain=15%)
R:0x8F, RT_SOUND size= 0 (compacted gain= 0%)
R:0x90, RT_POLY_ANIM size=32000 (compacted gain=62%)
R:0x91, RT_POLY_ANIM size=32000 (compacted gain=59%)

Total # resources: 146
Compressed : 120
Uncompressed : 28
Note: 82% of resources are compressed.

Total size (uncompressed) : 1820901 bytes.
Total size (compressed) : 1236519 bytes.
Note: Overall compression gain is : 32%.

Total RT_SOUND unpacked size: 699868 (38% of total unpacked size) packedSize 585052 (47% of floppy space) gain:(16%)
Total RT_MUSIC unpacked size: 33344 ( 2% of total unpacked size) packedSize 3540 ( 0% of floppy space) gain:(89%)
Total RT_POLY_ANIM unpacked size: 384000 (21% of total unpacked size) packedSize 106676 ( 9% of floppy space) gain:(72%)
Total RT_PALETTE unpacked size: 18432 ( 1% of total unpacked size) packedSize 11032 ( 1% of floppy space) gain:(40%)
Total RT_BYTECODE unpacked size: 203546 (11% of total unpacked size) packedSize 135948 (11% of floppy space) gain:(33%)
Total RT_POLY_CINEMATIC unpacked size: 365960 (20% of total unpacked size) packedSize 291008 (24% of floppy space) gain:(20%)
Note: Damn you sound compression rate!

Total bank files: 148
Total RT_SOUND files: 103
Total RT_MUSIC files: 3
Total RT_POLY_ANIM files: 12
Total RT_PALETTE files: 9
Total RT_BYTECODE files: 9
Total RT_POLY_CINEMATIC files: 9

setupPart(0)
Loaded resource 20 (RT_PALETTE) in segPalettes.
Loaded resource 21 (RT_BYTECODE) in segBytecode.
Loaded resource 22 (RT_POLY_CINEMATIC) in segCinematic
ERROR: Resource::setupPart() ec=0xCDCD invalid partId!
"

Figure out what's in the UNKNOWN 0x11 resource

There is one unknown resource with type=6 and id=0x11.

R:0x11, RT_UNKNOWN size=25108 (compacted gain=25%)

We should figure out what's inside. My guess is it might contain game specific strings such as "Good evening, professor." as well as font data and maybe something else.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.