mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-04 09:18:38 +00:00
DREAMWEB: Move generated constants out of class DreamGenContext
This commit is contained in:
parent
f9fddab379
commit
dc34fc1dfb
@ -617,29 +617,16 @@ namespace %s {
|
||||
|
||||
namespace %s {
|
||||
|
||||
class %sContext : public DreamBase, public Context {
|
||||
public:
|
||||
DreamGenContext() : DreamBase(), Context(_realData) {}
|
||||
|
||||
void __start();
|
||||
"""
|
||||
%(self.namespace, self.namespace))
|
||||
if self.skip_dispatch_call == False:
|
||||
self.hd.write(
|
||||
""" void __dispatch_call(uint16 addr);
|
||||
""")
|
||||
self.hd.write(
|
||||
"""#include "stubs.h" // Allow hand-reversed functions to have a signature different than void f()
|
||||
|
||||
""")
|
||||
%(self.namespace))
|
||||
|
||||
if self.skip_addr_constants == False:
|
||||
for name,addr in self.proc_addr:
|
||||
self.hd.write("\tstatic const uint16 addr_%s = 0x%04x;\n" %(name, addr))
|
||||
self.hd.write("static const uint16 addr_%s = 0x%04x;\n" %(name, addr))
|
||||
|
||||
|
||||
for name,addr in self.used_data_offsets:
|
||||
self.hd.write("\tstatic const uint16 offset_%s = 0x%04x;\n" %(name, addr))
|
||||
self.hd.write("static const uint16 offset_%s = 0x%04x;\n" %(name, addr))
|
||||
|
||||
offsets = []
|
||||
for k, v in self.context.get_globals().items():
|
||||
@ -650,8 +637,28 @@ public:
|
||||
|
||||
offsets = sorted(offsets, key=lambda t: t[1])
|
||||
for o in offsets:
|
||||
self.hd.write("\tstatic const uint16 k%s = %s;\n" %o)
|
||||
self.hd.write("static const uint16 k%s = %s;\n" %o)
|
||||
self.hd.write("\n")
|
||||
|
||||
self.hd.write(
|
||||
"""
|
||||
class %sContext : public DreamBase, public Context {
|
||||
public:
|
||||
DreamGenContext() : DreamBase(), Context(_realData) {}
|
||||
|
||||
void __start();
|
||||
"""
|
||||
%(self.namespace))
|
||||
if self.skip_dispatch_call == False:
|
||||
self.hd.write(
|
||||
""" void __dispatch_call(uint16 addr);
|
||||
""")
|
||||
self.hd.write(
|
||||
"""#include "stubs.h" // Allow hand-reversed functions to have a signature different than void f()
|
||||
|
||||
""")
|
||||
|
||||
|
||||
for p in set(self.methods):
|
||||
if p in self.blacklist:
|
||||
if self.header_omit_blacklisted == False:
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -107,8 +107,8 @@ void DreamWebEngine::waitForVSync() {
|
||||
}
|
||||
|
||||
void DreamWebEngine::quit() {
|
||||
_context.data.byte(DreamGen::DreamGenContext::kQuitrequested) = 1;
|
||||
_context.data.byte(DreamGen::DreamGenContext::kLasthardkey) = 1;
|
||||
_context.data.byte(DreamGen::kQuitrequested) = 1;
|
||||
_context.data.byte(DreamGen::kLasthardkey) = 1;
|
||||
}
|
||||
|
||||
void DreamWebEngine::processEvents() {
|
||||
@ -144,8 +144,8 @@ void DreamWebEngine::processEvents() {
|
||||
break;
|
||||
|
||||
case Common::KEYCODE_c: //skip statue puzzle
|
||||
_context.data.byte(DreamGen::DreamGenContext::kSymbolbotnum) = 3;
|
||||
_context.data.byte(DreamGen::DreamGenContext::kSymboltopnum) = 5;
|
||||
_context.data.byte(DreamGen::kSymbolbotnum) = 3;
|
||||
_context.data.byte(DreamGen::kSymboltopnum) = 5;
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -175,7 +175,7 @@ void DreamWebEngine::processEvents() {
|
||||
break;
|
||||
}
|
||||
|
||||
_context.data.byte(DreamGen::DreamGenContext::kLasthardkey) = hardKey;
|
||||
_context.data.byte(DreamGen::kLasthardkey) = hardKey;
|
||||
|
||||
// The rest of the keys are converted to ASCII. This
|
||||
// is fairly restrictive, and eventually we may want
|
||||
@ -219,7 +219,7 @@ Common::Error DreamWebEngine::run() {
|
||||
|
||||
getTimerManager()->installTimerProc(vSyncInterrupt, 1000000 / 70, this, "dreamwebVSync");
|
||||
_context.__start();
|
||||
_context.data.byte(DreamGen::DreamGenContext::kQuitrequested) = 0;
|
||||
_context.data.byte(DreamGen::kQuitrequested) = 0;
|
||||
|
||||
getTimerManager()->removeTimerProc(vSyncInterrupt);
|
||||
|
||||
@ -298,13 +298,13 @@ uint DreamWebEngine::readFromSaveFile(uint8 *data, uint size) {
|
||||
|
||||
void DreamWebEngine::keyPressed(uint16 ascii) {
|
||||
debug(2, "key pressed = %04x", ascii);
|
||||
uint16 in = (_context.data.word(DreamGen::DreamGenContext::kBufferin) + 1) & 0x0f;
|
||||
uint16 out = _context.data.word(DreamGen::DreamGenContext::kBufferout);
|
||||
uint16 in = (_context.data.word(DreamGen::kBufferin) + 1) & 0x0f;
|
||||
uint16 out = _context.data.word(DreamGen::kBufferout);
|
||||
if (in == out) {
|
||||
warning("keyboard buffer is full");
|
||||
return;
|
||||
}
|
||||
_context.data.word(DreamGen::DreamGenContext::kBufferin) = in;
|
||||
_context.data.word(DreamGen::kBufferin) = in;
|
||||
DreamGen::g_keyBuffer[in] = ascii;
|
||||
}
|
||||
|
||||
@ -329,11 +329,11 @@ void DreamWebEngine::mouseCall(uint16 *x, uint16 *y, uint16 *state) {
|
||||
}
|
||||
|
||||
void DreamWebEngine::fadeDos() {
|
||||
_context.ds = _context.es = _context.data.word(DreamGen::DreamGenContext::kBuffers);
|
||||
_context.ds = _context.es = _context.data.word(DreamGen::kBuffers);
|
||||
return; //fixme later
|
||||
waitForVSync();
|
||||
//processEvents will be called from vsync
|
||||
uint8 *dst = _context.es.ptr(DreamGen::DreamGenContext::kStartpal, 768);
|
||||
uint8 *dst = _context.es.ptr(DreamGen::kStartpal, 768);
|
||||
getPalette(dst, 0, 64);
|
||||
for(int fade = 0; fade < 64; ++fade) {
|
||||
for(int c = 0; c < 768; ++c) { //original sources decrement 768 values -> 256 colors
|
||||
@ -382,7 +382,7 @@ void DreamWebEngine::blit(const uint8 *src, int pitch, int x, int y, int w, int
|
||||
|
||||
void DreamWebEngine::printUnderMonitor() {
|
||||
uint8 *workspace = _context.workspace();
|
||||
uint8 *dst = workspace + DreamGen::DreamGenContext::kScreenwidth * 43 + 76;
|
||||
uint8 *dst = workspace + DreamGen::kScreenwidth * 43 + 76;
|
||||
|
||||
Graphics::Surface *s = _system->lockScreen();
|
||||
if (!s)
|
||||
@ -397,7 +397,7 @@ void DreamWebEngine::printUnderMonitor() {
|
||||
++dst; ++src;
|
||||
}
|
||||
}
|
||||
dst += DreamGen::DreamGenContext::kScreenwidth - 170;
|
||||
dst += DreamGen::kScreenwidth - 170;
|
||||
}
|
||||
_system->unlockScreen();
|
||||
}
|
||||
@ -490,12 +490,12 @@ bool DreamWebEngine::loadSpeech(const Common::String &filename) {
|
||||
}
|
||||
|
||||
void DreamWebEngine::soundHandler() {
|
||||
_context.data.byte(_context.kSubtitles) = ConfMan.getBool("subtitles");
|
||||
_context.data.byte(DreamGen::kSubtitles) = ConfMan.getBool("subtitles");
|
||||
_context.push(_context.ax);
|
||||
_context.volumeAdjust();
|
||||
_context.ax = _context.pop();
|
||||
|
||||
uint volume = _context.data.byte(DreamGen::DreamGenContext::kVolume);
|
||||
uint volume = _context.data.byte(DreamGen::kVolume);
|
||||
//.vol file loaded into soundbuf:0x4000
|
||||
//volume table at (volume * 0x100 + 0x3f00)
|
||||
//volume value could be from 1 to 7
|
||||
@ -511,13 +511,13 @@ void DreamWebEngine::soundHandler() {
|
||||
volume = (8 - volume) * Audio::Mixer::kMaxChannelVolume / 8;
|
||||
_mixer->setChannelVolume(_channelHandle[0], volume);
|
||||
|
||||
uint8 ch0 = _context.data.byte(DreamGen::DreamGenContext::kCh0playing);
|
||||
uint8 ch0 = _context.data.byte(DreamGen::kCh0playing);
|
||||
if (ch0 == 255)
|
||||
ch0 = 0;
|
||||
uint8 ch1 = _context.data.byte(DreamGen::DreamGenContext::kCh1playing);
|
||||
uint8 ch1 = _context.data.byte(DreamGen::kCh1playing);
|
||||
if (ch1 == 255)
|
||||
ch1 = 0;
|
||||
uint8 ch0loop = _context.data.byte(DreamGen::DreamGenContext::kCh0repeat);
|
||||
uint8 ch0loop = _context.data.byte(DreamGen::kCh0repeat);
|
||||
|
||||
if (_channel0 != ch0) {
|
||||
_channel0 = ch0;
|
||||
@ -532,11 +532,11 @@ void DreamWebEngine::soundHandler() {
|
||||
}
|
||||
}
|
||||
if (!_mixer->isSoundHandleActive(_channelHandle[0])) {
|
||||
_context.data.byte(DreamGen::DreamGenContext::kCh0playing) = 255;
|
||||
_context.data.byte(DreamGen::kCh0playing) = 255;
|
||||
_channel0 = 0;
|
||||
}
|
||||
if (!_mixer->isSoundHandleActive(_channelHandle[1])) {
|
||||
_context.data.byte(DreamGen::DreamGenContext::kCh1playing) = 255;
|
||||
_context.data.byte(DreamGen::kCh1playing) = 255;
|
||||
_channel1 = 0;
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ uint8 DreamBase::getNextWord(const Frame *charSet, const uint8 *string, uint8 *t
|
||||
firstChar = engine->modifyChar(firstChar);
|
||||
if (firstChar != 255) {
|
||||
uint8 secondChar = *string;
|
||||
uint8 width = charSet[firstChar - 32 + data.word(DreamGenContext::kCharshift)].width;
|
||||
uint8 width = charSet[firstChar - 32 + data.word(kCharshift)].width;
|
||||
width = kernChars(firstChar, secondChar, width);
|
||||
*totalWidth += width;
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ void DreamBase::frameOutFx(uint8 *dst, const uint8 *src, uint16 pitch, uint16 wi
|
||||
}
|
||||
|
||||
void DreamBase::doShake() {
|
||||
uint8 &counter = data.byte(DreamGenContext::kShakecounter);
|
||||
uint8 &counter = data.byte(kShakecounter);
|
||||
if (counter == 48)
|
||||
return;
|
||||
|
||||
@ -227,7 +227,7 @@ void DreamGenContext::showPCX(const Common::String &name) {
|
||||
// the color components have to be adjusted from 8 to 6 bits.
|
||||
|
||||
pcxFile.seek(16, SEEK_SET);
|
||||
mainGamePal = getSegment(data.word(DreamGenContext::kBuffers)).ptr(DreamGenContext::kMaingamepal, 768);
|
||||
mainGamePal = getSegment(data.word(kBuffers)).ptr(kMaingamepal, 768);
|
||||
pcxFile.read(mainGamePal, 48);
|
||||
|
||||
memset(mainGamePal + 48, 0xff, 720);
|
||||
|
Loading…
x
Reference in New Issue
Block a user