ALL: sync with ScummVM

This commit is contained in:
Pawel Kolodziejski 2014-07-02 01:02:35 +02:00
parent 2984c92a47
commit 88b93b36dd
62 changed files with 3175 additions and 1313 deletions

View file

@ -72,9 +72,9 @@ bool PS3SdlEventSource::handleJoyButtonDown(SDL_Event &ev, Common::Event &event)
event.kbd.ascii = mapKey(SDLK_F5, (SDLMod) ev.key.keysym.mod, 0);
break;
case BTN_SELECT: // Virtual keyboard
event.type = Common::EVENT_KEYDOWN;
event.kbd.keycode = Common::KEYCODE_F7;
event.kbd.ascii = mapKey(SDLK_F7, (SDLMod) ev.key.keysym.mod, 0);
#ifdef ENABLE_VKEYBD
event.type = Common::EVENT_VIRTUAL_KEYBOARD;
#endif
break;
case BTN_SQUARE: // Escape
event.type = Common::EVENT_KEYDOWN;
@ -110,9 +110,7 @@ bool PS3SdlEventSource::handleJoyButtonUp(SDL_Event &ev, Common::Event &event) {
event.kbd.ascii = mapKey(SDLK_F5, (SDLMod) ev.key.keysym.mod, 0);
break;
case BTN_SELECT: // Virtual keyboard
event.type = Common::EVENT_KEYUP;
event.kbd.keycode = Common::KEYCODE_F7;
event.kbd.ascii = mapKey(SDLK_F7, (SDLMod) ev.key.keysym.mod, 0);
// Handled in key down
break;
case BTN_SQUARE: // Escape
event.type = Common::EVENT_KEYUP;

View file

@ -38,10 +38,10 @@ bool SamsungTVSdlEventSource::remapKey(SDL_Event &ev, Common::Event &event) {
event.kbd.ascii = Common::ASCII_F5;
return true;
} else if (ev.key.keysym.sym == SDLK_F2 && ev.key.keysym.scancode == 21) {
event.type = Common::EVENT_KEYDOWN;
event.kbd.keycode = Common::KEYCODE_F7;
event.kbd.ascii = Common::ASCII_F7;
#ifdef ENABLE_VKEYBD
event.type = Common::EVENT_VIRTUAL_KEYBOARD;
return true;
#endif
}
break;
}
@ -54,11 +54,6 @@ bool SamsungTVSdlEventSource::remapKey(SDL_Event &ev, Common::Event &event) {
event.kbd.keycode = Common::KEYCODE_F5;
event.kbd.ascii = Common::ASCII_F5;
return true;
} else if (ev.key.keysym.sym == SDLK_F2 && ev.key.keysym.scancode == 21) {
event.type = Common::EVENT_KEYUP;
event.kbd.keycode = Common::KEYCODE_F7;
event.kbd.ascii = Common::ASCII_F7;
return true;
}
break;
}

View file

@ -33,9 +33,8 @@
#ifdef GP2X
#define SAMPLES_PER_SEC 11025
#else
#define SAMPLES_PER_SEC 22050
#define SAMPLES_PER_SEC 44100
#endif
//#define SAMPLES_PER_SEC 44100
SdlMixerManager::SdlMixerManager()
:

View file

@ -33,9 +33,8 @@
#ifdef GP2X
#define SAMPLES_PER_SEC 11025
#else
#define SAMPLES_PER_SEC 22050
#define SAMPLES_PER_SEC 44100
#endif
//#define SAMPLES_PER_SEC 44100
Sdl13MixerManager::Sdl13MixerManager()
:

View file

@ -68,7 +68,7 @@ void OSystem_Android::setupKeymapper() {
Action *act;
act = new Action(globalMap, "VIRT", "Display keyboard");
act->addKeyEvent(KeyState(KEYCODE_F7, ASCII_F7, 0));
act->addKeyEvent(KeyState(KEYCODE_F7, ASCII_F7, KBD_CTRL));
mapper->addGlobalKeymap(globalMap);

View file

@ -793,7 +793,7 @@ void OSystem_Android::setMouseCursor(const void *buf, uint w, uint h,
return;
}
uint16 *s = (uint16 *)buf;
const uint16 *s = (const uint16 *)buf;
uint16 *d = (uint16 *)tmp;
for (uint16 y = 0; y < h; ++y, d += pitch / 2 - w)
for (uint16 x = 0; x < w; ++x, d++)

View file

@ -145,7 +145,7 @@ Common::String OSystem_MacOSX::getSystemLanguage() const {
for (CFIndex i = 0 ; i < localizationsSize ; ++i) {
CFStringRef language = (CFStringRef)CFArrayGetValueAtIndex(preferredLocalizations, i);
char buffer[10];
CFStringGetCString(language, buffer, 50, kCFStringEncodingASCII);
CFStringGetCString(language, buffer, sizeof(buffer), kCFStringEncodingASCII);
int32 languageId = TransMan.findMatchingLanguage(buffer);
if (languageId != -1) {
CFRelease(preferredLocalizations);
@ -156,7 +156,7 @@ Common::String OSystem_MacOSX::getSystemLanguage() const {
if (localizationsSize > 0) {
CFStringRef language = (CFStringRef)CFArrayGetValueAtIndex(preferredLocalizations, 0);
char buffer[10];
CFStringGetCString(language, buffer, 50, kCFStringEncodingASCII);
CFStringGetCString(language, buffer, sizeof(buffer), kCFStringEncodingASCII);
CFRelease(preferredLocalizations);
return buffer;
}

View file

@ -0,0 +1,27 @@
ps3pkg: $(EXECUTABLE)
$(STRIP) $(EXECUTABLE)
sprxlinker $(EXECUTABLE)
mkdir -p ps3pkg/USRDIR/data/
mkdir -p ps3pkg/USRDIR/doc/
mkdir -p ps3pkg/USRDIR/saves/
make_self_npdrm "$(EXECUTABLE)" ps3pkg/USRDIR/EBOOT.BIN UP0001-RESI12000_00-0000000000000000
cp $(DIST_FILES_THEMES) ps3pkg/USRDIR/data/
ifdef DIST_FILES_ENGINEDATA
cp $(DIST_FILES_ENGINEDATA) ps3pkg/USRDIR/data/
endif
cp $(DIST_FILES_DOCS) ps3pkg/USRDIR/doc/
cp $(srcdir)/dists/ps3/readme-ps3.md ps3pkg/USRDIR/doc/
cp $(srcdir)/backends/vkeybd/packs/vkeybd_default.zip ps3pkg/USRDIR/data/
cp $(srcdir)/backends/vkeybd/packs/vkeybd_small.zip ps3pkg/USRDIR/data/
cp $(srcdir)/dists/ps3/ICON0.PNG ps3pkg/
cp $(srcdir)/dists/ps3/PIC1.PNG ps3pkg/
sfo.py -f $(srcdir)/dists/ps3/sfo.xml ps3pkg/PARAM.SFO
pkg.py --contentid UP0001-RESI12000_00-0000000000000000 ps3pkg/ residualvm-ps3.pkg
ps3run: $(EXECUTABLE)
$(STRIP) $(EXECUTABLE)
sprxlinker $(EXECUTABLE)
make_self $(EXECUTABLE) $(EXECUTABLE).self
ps3load $(EXECUTABLE).self
.PHONY: ps3pkg ps3run

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

View file

@ -0,0 +1,637 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<keyboard initial_mode="lowercase" v_align="bottom" h_align="center">
<!-- coords key = "start x, start y, end x, end y" -->
<!-- Lowercase -->
<mode name="lowercase" resolutions="320x240">
<layout resolution="320x240" bitmap="lowercase320x240.bmp" transparent_color="255,0,255">
<map>
<area shape="rect" coords="13,8,306,20" target="display_area" />
<area shape="rect" coords="9,26,25,42" target="esc" />
<area shape="rect" coords="50,25,67,43" target="f2" />
<area shape="rect" coords="29,24,46,43" target="f1" />
<area shape="rect" coords="71,26,88,44" target="f3" />
<area shape="rect" coords="90,25,107,43" target="f4" />
<area shape="rect" coords="111,26,128,44" target="f5" />
<area shape="rect" coords="132,26,149,44" target="f6" />
<area shape="rect" coords="153,25,170,44" target="f7" />
<area shape="rect" coords="173,26,190,44" target="f8" />
<area shape="rect" coords="194,24,211,43" target="f9" />
<area shape="rect" coords="215,26,231,44" target="f10" />
<area shape="rect" coords="235,26,253,43" target="f11" />
<area shape="rect" coords="255,26,272,45" target="f12" />
<area shape="rect" coords="276,27,310,43" target="del" />
<area shape="rect" coords="276,46,299,65" target="delete" />
<area shape="rect" coords="300,46,311,65" target="backspace" />
<area shape="rect" coords="8,68,32,85" target="tab" />
<area shape="rect" coords="36,68,53,85" target="q" />
<area shape="rect" coords="57,68,75,86" target="w" />
<area shape="rect" coords="78,67,94,85" target="e" />
<area shape="rect" coords="98,67,115,85" target="r" />
<area shape="rect" coords="119,67,136,85" target="t" />
<area shape="rect" coords="141,68,158,86" target="y" />
<area shape="rect" coords="161,67,179,86" target="u" />
<area shape="rect" coords="182,67,199,86" target="i" />
<area shape="rect" coords="202,67,220,85" target="o" />
<area shape="rect" coords="223,68,240,86" target="p" />
<area shape="rect" coords="44,88,63,107" target="a" />
<area shape="rect" coords="65,88,84,106" target="s" />
<area shape="rect" coords="86,89,104,107" target="d" />
<area shape="rect" coords="107,89,124,107" target="f" />
<area shape="rect" coords="128,89,145,107" target="g" />
<area shape="rect" coords="149,88,165,107" target="h" />
<area shape="rect" coords="169,89,186,107" target="j" />
<area shape="rect" coords="189,89,207,107" target="k" />
<area shape="rect" coords="210,89,228,107" target="l" />
<area shape="rect" coords="273,89,311,106" target="enter" />
<area shape="rect" coords="9,110,50,127" target="shift" />
<area shape="rect" coords="8,89,41,106" target="caps" />
<area shape="rect" coords="58,110,75,128" target="z" />
<area shape="rect" coords="79,110,96,128" target="x" />
<area shape="rect" coords="99,109,116,127" target="c" />
<area shape="rect" coords="120,110,138,128" target="v" />
<area shape="rect" coords="141,109,157,127" target="b" />
<area shape="rect" coords="162,110,179,128" target="n" />
<area shape="rect" coords="182,110,199,128" target="m" />
<area shape="rect" coords="271,109,311,128" target="symbols" />
<area shape="rect" coords="9,130,33,148" target="ctrl" />
<area shape="rect" coords="38,130,61,147" target="alt" />
<area shape="rect" coords="67,130,262,148" target="space" />
<area shape="rect" coords="8,47,26,64" target="|" />
<area shape="rect" coords="28,47,45,64" target="1" />
<area shape="rect" coords="50,47,67,65" target="2" />
<area shape="rect" coords="70,46,87,65" target="3" />
<area shape="rect" coords="91,46,108,64" target="4" />
<area shape="rect" coords="111,46,129,65" target="5" />
<area shape="rect" coords="132,47,149,65" target="6" />
<area shape="rect" coords="152,47,170,64" target="7" />
<area shape="rect" coords="174,46,191,63" target="8" />
<area shape="rect" coords="194,47,211,65" target="9" />
<area shape="rect" coords="215,46,232,64" target="0" />
<area shape="rect" coords="235,47,252,65" target="-" />
<area shape="rect" coords="255,46,272,65" target="=" />
<area shape="rect" coords="244,68,261,86" target="[" />
<area shape="rect" coords="264,67,282,86" target="]" />
<area shape="rect" coords="284,68,309,86" target="#" />
<area shape="rect" coords="231,88,249,106" target=";" />
<area shape="rect" coords="251,89,269,107" target="" />
<area shape="rect" coords="202,110,219,128" target="," />
<area shape="rect" coords="223,110,241,128" target="." />
<area shape="rect" coords="243,110,261,128" target="/" />
<area shape="rect" coords="269,131,288,150" target="ok" />
<area shape="rect" coords="292,131,311,150" target="cancel" />
</map>
</layout>
<event name="esc" type="key" code="27" ascii="27" modifiers="" />
<event name="f1" type="key" code="282" ascii="315" modifiers="" />
<event name="f2" type="key" code="283" ascii="316" modifiers="" />
<event name="f3" type="key" code="284" ascii="317" modifiers="" />
<event name="f4" type="key" code="285" ascii="318" modifiers="" />
<event name="f5" type="key" code="286" ascii="319" modifiers="" />
<event name="f6" type="key" code="287" ascii="320" modifiers="" />
<event name="f7" type="key" code="288" ascii="321" modifiers="" />
<event name="f8" type="key" code="289" ascii="322" modifiers="" />
<event name="f9" type="key" code="290" ascii="323" modifiers="" />
<event name="f10" type="key" code="291" ascii="324" modifiers="" />
<event name="f11" type="key" code="292" ascii="325" modifiers="" />
<event name="f12" type="key" code="293" ascii="326" modifiers="" />
<event name="del" type="key" code="127" ascii="0" modifiers="" />
<event name="ctrl" type="modifier" modifiers="ctrl" />
<event name="alt" type="modifier" modifiers="alt" />
<event name="shift" type="modifier" modifiers="shift" />
<event name="caps" type="switch_mode" mode="uppercase" />
<event name="symbols" type="switch_mode" mode="lowercasesymbols" />
<event name="backspace" type="key" code="8" ascii="8" modifiers="" />
<event name="enter" type="key" code="13" ascii="13" modifiers="" />
<event name="|" type="key" code="124" ascii="124" modifiers="" />
<event name="-" type="key" code="45" ascii="45" modifiers="" />
<event name="=" type="key" code="61" ascii="61" modifiers="" />
<event name="[" type="key" code="91" ascii="91" modifiers="" />
<event name="]" type="key" code="93" ascii="93" modifiers="" />
<event name="#" type="key" code="35" ascii="35" modifiers="" />
<event name=";" type="key" code="59" ascii="59" modifiers="" />
<event name="'" type="key" code="39" ascii="39" modifiers="" />
<event name="," type="key" code="44" ascii="44" modifiers="" />
<event name="." type="key" code="46" ascii="46" modifiers="" />
<event name="/" type="key" code="47" ascii="47" modifiers="" />
<event name="space" type="key" code="32" ascii="32" modifiers="" />
<event name="tab" type="key" code="9" ascii="9" modifiers="" />
<event name="a" type="key" code="97" ascii="97" modifiers="" />
<event name="b" type="key" code="98" ascii="98" modifiers="" />
<event name="c" type="key" code="99" ascii="99" modifiers="" />
<event name="d" type="key" code="100" ascii="100" modifiers="" />
<event name="e" type="key" code="101" ascii="101" modifiers="" />
<event name="f" type="key" code="102" ascii="102" modifiers="" />
<event name="g" type="key" code="103" ascii="103" modifiers="" />
<event name="h" type="key" code="104" ascii="104" modifiers="" />
<event name="i" type="key" code="105" ascii="105" modifiers="" />
<event name="j" type="key" code="106" ascii="106" modifiers="" />
<event name="k" type="key" code="107" ascii="107" modifiers="" />
<event name="l" type="key" code="108" ascii="108" modifiers="" />
<event name="m" type="key" code="109" ascii="109" modifiers="" />
<event name="n" type="key" code="110" ascii="110" modifiers="" />
<event name="o" type="key" code="111" ascii="111" modifiers="" />
<event name="p" type="key" code="112" ascii="112" modifiers="" />
<event name="q" type="key" code="113" ascii="113" modifiers="" />
<event name="r" type="key" code="114" ascii="114" modifiers="" />
<event name="s" type="key" code="115" ascii="115" modifiers="" />
<event name="t" type="key" code="116" ascii="116" modifiers="" />
<event name="u" type="key" code="117" ascii="117" modifiers="" />
<event name="v" type="key" code="118" ascii="118" modifiers="" />
<event name="w" type="key" code="119" ascii="119" modifiers="" />
<event name="x" type="key" code="120" ascii="120" modifiers="" />
<event name="y" type="key" code="121" ascii="121" modifiers="" />
<event name="z" type="key" code="122" ascii="122" modifiers="" />
<event name="0" type="key" code="48" ascii="48" modifiers="" />
<event name="1" type="key" code="49" ascii="49" modifiers="" />
<event name="2" type="key" code="50" ascii="50" modifiers="" />
<event name="3" type="key" code="51" ascii="51" modifiers="" />
<event name="4" type="key" code="52" ascii="52" modifiers="" />
<event name="5" type="key" code="53" ascii="53" modifiers="" />
<event name="6" type="key" code="54" ascii="54" modifiers="" />
<event name="7" type="key" code="55" ascii="55" modifiers="" />
<event name="8" type="key" code="56" ascii="56" modifiers="" />
<event name="9" type="key" code="57" ascii="57" modifiers="" />
<event name="ok" type="submit" />
<event name="cancel" type="cancel" />
<event name="quit" type="submit" />
<event name="delete" type="delete" />
</mode>
<!-- Uppercase -->
<mode name="uppercase" resolutions="320x240">
<layout resolution="320x240" bitmap="uppercase320x240.bmp" transparent_color="255,0,255">
<map>
<area shape="rect" coords="13,8,306,20" target="display_area" />
<area shape="rect" coords="9,26,25,42" target="esc" />
<area shape="rect" coords="50,25,67,43" target="f2" />
<area shape="rect" coords="29,24,46,43" target="f1" />
<area shape="rect" coords="71,26,88,44" target="f3" />
<area shape="rect" coords="90,25,107,43" target="f4" />
<area shape="rect" coords="111,26,128,44" target="f5" />
<area shape="rect" coords="132,26,149,44" target="f6" />
<area shape="rect" coords="153,25,170,44" target="f7" />
<area shape="rect" coords="173,26,190,44" target="f8" />
<area shape="rect" coords="194,24,211,43" target="f9" />
<area shape="rect" coords="215,26,231,44" target="f10" />
<area shape="rect" coords="235,26,253,43" target="f11" />
<area shape="rect" coords="255,26,272,45" target="f12" />
<area shape="rect" coords="276,27,310,43" target="del" />
<area shape="rect" coords="276,46,299,65" target="delete" />
<area shape="rect" coords="300,46,311,65" target="backspace" />
<area shape="rect" coords="8,68,32,85" target="tab" />
<area shape="rect" coords="36,68,53,85" target="Q" />
<area shape="rect" coords="57,68,75,86" target="W" />
<area shape="rect" coords="78,67,94,85" target="E" />
<area shape="rect" coords="98,67,115,85" target="R" />
<area shape="rect" coords="119,67,136,85" target="T" />
<area shape="rect" coords="141,68,158,86" target="Y" />
<area shape="rect" coords="161,67,179,86" target="U" />
<area shape="rect" coords="182,67,199,86" target="I" />
<area shape="rect" coords="202,67,220,85" target="O" />
<area shape="rect" coords="223,68,240,86" target="P" />
<area shape="rect" coords="44,88,63,107" target="A" />
<area shape="rect" coords="65,88,84,106" target="S" />
<area shape="rect" coords="86,89,104,107" target="D" />
<area shape="rect" coords="107,89,124,107" target="F" />
<area shape="rect" coords="128,89,145,107" target="G" />
<area shape="rect" coords="149,88,165,107" target="H" />
<area shape="rect" coords="169,89,186,107" target="J" />
<area shape="rect" coords="189,89,207,107" target="K" />
<area shape="rect" coords="210,89,228,107" target="L" />
<area shape="rect" coords="273,89,311,106" target="enter" />
<area shape="rect" coords="9,110,50,127" target="shift" />
<area shape="rect" coords="8,89,41,106" target="caps" />
<area shape="rect" coords="58,110,75,128" target="Z" />
<area shape="rect" coords="79,110,96,128" target="X" />
<area shape="rect" coords="99,109,116,127" target="C" />
<area shape="rect" coords="120,110,138,128" target="V" />
<area shape="rect" coords="141,109,157,127" target="B" />
<area shape="rect" coords="162,110,179,128" target="N" />
<area shape="rect" coords="182,110,199,128" target="M" />
<area shape="rect" coords="271,109,311,128" target="symbols" />
<area shape="rect" coords="9,130,33,148" target="ctrl" />
<area shape="rect" coords="38,130,61,147" target="alt" />
<area shape="rect" coords="67,130,262,148" target="space" />
<area shape="rect" coords="8,47,26,64" target="|" />
<area shape="rect" coords="28,47,45,64" target="1" />
<area shape="rect" coords="50,47,67,65" target="2" />
<area shape="rect" coords="70,46,87,65" target="3" />
<area shape="rect" coords="91,46,108,64" target="4" />
<area shape="rect" coords="111,46,129,65" target="5" />
<area shape="rect" coords="132,47,149,65" target="6" />
<area shape="rect" coords="152,47,170,64" target="7" />
<area shape="rect" coords="174,46,191,63" target="8" />
<area shape="rect" coords="194,47,211,65" target="9" />
<area shape="rect" coords="215,46,232,64" target="0" />
<area shape="rect" coords="235,47,252,65" target="-" />
<area shape="rect" coords="255,46,272,65" target="=" />
<area shape="rect" coords="244,68,261,86" target="[" />
<area shape="rect" coords="264,67,282,86" target="]" />
<area shape="rect" coords="284,68,309,86" target="#" />
<area shape="rect" coords="231,88,249,106" target=";" />
<area shape="rect" coords="251,89,269,107" target="" />
<area shape="rect" coords="202,110,219,128" target="," />
<area shape="rect" coords="223,110,241,128" target="." />
<area shape="rect" coords="243,110,261,128" target="/" />
<area shape="rect" coords="269,131,288,150" target="ok" />
<area shape="rect" coords="292,131,311,150" target="cancel" />
</map>
</layout>
<event name="esc" type="key" code="27" ascii="27" modifiers="" />
<event name="f1" type="key" code="282" ascii="315" modifiers="" />
<event name="f2" type="key" code="283" ascii="316" modifiers="" />
<event name="f3" type="key" code="284" ascii="317" modifiers="" />
<event name="f4" type="key" code="285" ascii="318" modifiers="" />
<event name="f5" type="key" code="286" ascii="319" modifiers="" />
<event name="f6" type="key" code="287" ascii="320" modifiers="" />
<event name="f7" type="key" code="288" ascii="321" modifiers="" />
<event name="f8" type="key" code="289" ascii="322" modifiers="" />
<event name="f9" type="key" code="290" ascii="323" modifiers="" />
<event name="f10" type="key" code="291" ascii="324" modifiers="" />
<event name="f11" type="key" code="292" ascii="325" modifiers="" />
<event name="f12" type="key" code="293" ascii="326" modifiers="" />
<event name="del" type="key" code="127" ascii="0" modifiers="" />
<event name="ctrl" type="modifier" modifiers="ctrl" />
<event name="alt" type="modifier" modifiers="alt" />
<event name="shift" type="modifier" modifiers="shift" />
<event name="caps" type="switch_mode" mode="lowercase" />
<event name="symbols" type="switch_mode" mode="uppercasesymbols" />
<event name="backspace" type="key" code="8" ascii="8" modifiers="" />
<event name="enter" type="key" code="13" ascii="13" modifiers="" />
<event name="|" type="key" code="124" ascii="124" modifiers="" />
<event name="-" type="key" code="45" ascii="45" modifiers="" />
<event name="=" type="key" code="61" ascii="61" modifiers="" />
<event name="[" type="key" code="91" ascii="91" modifiers="" />
<event name="]" type="key" code="93" ascii="93" modifiers="" />
<event name="#" type="key" code="35" ascii="35" modifiers="" />
<event name=";" type="key" code="59" ascii="59" modifiers="" />
<event name="'" type="key" code="39" ascii="39" modifiers="" />
<event name="," type="key" code="44" ascii="44" modifiers="" />
<event name="." type="key" code="46" ascii="46" modifiers="" />
<event name="/" type="key" code="47" ascii="47" modifiers="" />
<event name="space" type="key" code="32" ascii="32" modifiers="" />
<event name="tab" type="key" code="9" ascii="9" modifiers="" />
<event name="A" type="key" code="97" ascii="65" modifiers="shift" />
<event name="B" type="key" code="98" ascii="66" modifiers="shift" />
<event name="C" type="key" code="99" ascii="67" modifiers="shift" />
<event name="D" type="key" code="100" ascii="68" modifiers="shift" />
<event name="E" type="key" code="101" ascii="69" modifiers="shift" />
<event name="F" type="key" code="102" ascii="70" modifiers="shift" />
<event name="G" type="key" code="103" ascii="71" modifiers="shift" />
<event name="H" type="key" code="104" ascii="72" modifiers="shift" />
<event name="I" type="key" code="105" ascii="73" modifiers="shift" />
<event name="J" type="key" code="106" ascii="74" modifiers="shift" />
<event name="K" type="key" code="107" ascii="75" modifiers="shift" />
<event name="L" type="key" code="108" ascii="76" modifiers="shift" />
<event name="M" type="key" code="109" ascii="77" modifiers="shift" />
<event name="N" type="key" code="110" ascii="78" modifiers="shift" />
<event name="O" type="key" code="111" ascii="79" modifiers="shift" />
<event name="P" type="key" code="112" ascii="80" modifiers="shift" />
<event name="Q" type="key" code="113" ascii="81" modifiers="shift" />
<event name="R" type="key" code="114" ascii="82" modifiers="shift" />
<event name="S" type="key" code="115" ascii="83" modifiers="shift" />
<event name="T" type="key" code="116" ascii="84" modifiers="shift" />
<event name="U" type="key" code="117" ascii="85" modifiers="shift" />
<event name="V" type="key" code="118" ascii="86" modifiers="shift" />
<event name="W" type="key" code="119" ascii="87" modifiers="shift" />
<event name="X" type="key" code="120" ascii="88" modifiers="shift" />
<event name="Y" type="key" code="121" ascii="89" modifiers="shift" />
<event name="Z" type="key" code="122" ascii="90" modifiers="shift" />
<event name="0" type="key" code="48" ascii="48" modifiers="" />
<event name="1" type="key" code="49" ascii="49" modifiers="" />
<event name="2" type="key" code="50" ascii="50" modifiers="" />
<event name="3" type="key" code="51" ascii="51" modifiers="" />
<event name="4" type="key" code="52" ascii="52" modifiers="" />
<event name="5" type="key" code="53" ascii="53" modifiers="" />
<event name="6" type="key" code="54" ascii="54" modifiers="" />
<event name="7" type="key" code="55" ascii="55" modifiers="" />
<event name="8" type="key" code="56" ascii="56" modifiers="" />
<event name="9" type="key" code="57" ascii="57" modifiers="" />
<event name="ok" type="submit" />
<event name="cancel" type="cancel" />
<event name="quit" type="submit" />
<event name="delete" type="delete" />
</mode>
<!-- Lowercase Symbols -->
<mode name="lowercasesymbols" resolutions="320x240">
<layout resolution="320x240" bitmap="lowercase-symbols320x240.bmp" transparent_color="255,0,255">
<map>
<area shape="rect" coords="13,8,306,20" target="display_area" />
<area shape="rect" coords="9,26,25,42" target="esc" />
<area shape="rect" coords="50,25,67,43" target="f2" />
<area shape="rect" coords="29,24,46,43" target="f1" />
<area shape="rect" coords="71,26,88,44" target="f3" />
<area shape="rect" coords="90,25,107,43" target="f4" />
<area shape="rect" coords="111,26,128,44" target="f5" />
<area shape="rect" coords="132,26,149,44" target="f6" />
<area shape="rect" coords="153,25,170,44" target="f7" />
<area shape="rect" coords="173,26,190,44" target="f8" />
<area shape="rect" coords="194,24,211,43" target="f9" />
<area shape="rect" coords="215,26,231,44" target="f10" />
<area shape="rect" coords="235,26,253,43" target="f11" />
<area shape="rect" coords="255,26,272,45" target="f12" />
<area shape="rect" coords="276,27,310,43" target="del" />
<area shape="rect" coords="8,47,26,64" target="¬" />
<area shape="rect" coords="28,47,45,64" target="!" />
<area shape="rect" coords="50,47,67,65" target="quote" />
<area shape="rect" coords="70,46,87,65" target="£" />
<area shape="rect" coords="91,46,108,64" target="$" />
<area shape="rect" coords="111,46,129,65" target="%" />
<area shape="rect" coords="132,47,149,65" target="^" />
<area shape="rect" coords="152,47,170,64" target="&amp;" />
<area shape="rect" coords="174,46,191,63" target="*" />
<area shape="rect" coords="194,47,211,65" target="(" />
<area shape="rect" coords="215,46,232,64" target=")" />
<area shape="rect" coords="235,47,252,65" target="_" />
<area shape="rect" coords="255,46,272,65" target="+" />
<area shape="rect" coords="276,46,299,65" target="delete" />
<area shape="rect" coords="300,46,311,65" target="backspace" />
<area shape="rect" coords="8,68,32,85" target="tab" />
<area shape="rect" coords="36,68,53,85" target="q" />
<area shape="rect" coords="57,68,75,86" target="w" />
<area shape="rect" coords="78,67,94,85" target="e" />
<area shape="rect" coords="98,67,115,85" target="r" />
<area shape="rect" coords="119,67,136,85" target="t" />
<area shape="rect" coords="141,68,158,86" target="y" />
<area shape="rect" coords="161,67,179,86" target="u" />
<area shape="rect" coords="182,67,199,86" target="i" />
<area shape="rect" coords="202,67,220,85" target="o" />
<area shape="rect" coords="223,68,240,86" target="p" />
<area shape="rect" coords="244,68,261,86" target="{" />
<area shape="rect" coords="264,67,282,86" target="}" />
<area shape="rect" coords="284,68,309,86" target="~" />
<area shape="rect" coords="8,89,41,106" target="caps" />
<area shape="rect" coords="44,88,63,107" target="a" />
<area shape="rect" coords="65,88,84,106" target="s" />
<area shape="rect" coords="86,89,104,107" target="d" />
<area shape="rect" coords="107,89,124,107" target="f" />
<area shape="rect" coords="128,89,145,107" target="g" />
<area shape="rect" coords="149,88,165,107" target="h" />
<area shape="rect" coords="169,89,186,107" target="j" />
<area shape="rect" coords="189,89,207,107" target="k" />
<area shape="rect" coords="210,89,228,107" target="l" />
<area shape="rect" coords="231,88,249,106" target=":" />
<area shape="rect" coords="251,89,269,107" target="@" />
<area shape="rect" coords="273,89,311,106" target="enter" />
<area shape="rect" coords="9,110,50,127" target="shift" />
<area shape="rect" coords="58,110,75,128" target="z" />
<area shape="rect" coords="79,110,96,128" target="x" />
<area shape="rect" coords="99,109,116,127" target="c" />
<area shape="rect" coords="120,110,138,128" target="v" />
<area shape="rect" coords="141,109,157,127" target="b" />
<area shape="rect" coords="162,110,179,128" target="n" />
<area shape="rect" coords="182,110,199,128" target="m" />
<area shape="rect" coords="202,110,219,128" target="&lt;" />
<area shape="rect" coords="223,110,241,128" target="&gt;" />
<area shape="rect" coords="243,110,261,128" target="?" />
<area shape="rect" coords="271,109,311,128" target="symbols" />
<area shape="rect" coords="9,130,33,148" target="ctrl" />
<area shape="rect" coords="38,130,61,147" target="alt" />
<area shape="rect" coords="67,130,262,148" target="space" />
<area shape="rect" coords="269,131,288,150" target="ok" />
<area shape="rect" coords="292,131,311,150" target="cancel" />
</map>
</layout>
<event name="esc" type="key" code="27" ascii="27" modifiers="" />
<event name="f1" type="key" code="282" ascii="315" modifiers="" />
<event name="f2" type="key" code="283" ascii="316" modifiers="" />
<event name="f3" type="key" code="284" ascii="317" modifiers="" />
<event name="f4" type="key" code="285" ascii="318" modifiers="" />
<event name="f5" type="key" code="286" ascii="319" modifiers="" />
<event name="f6" type="key" code="287" ascii="320" modifiers="" />
<event name="f7" type="key" code="288" ascii="321" modifiers="" />
<event name="f8" type="key" code="289" ascii="322" modifiers="" />
<event name="f9" type="key" code="290" ascii="323" modifiers="" />
<event name="f10" type="key" code="291" ascii="324" modifiers="" />
<event name="f11" type="key" code="292" ascii="325" modifiers="" />
<event name="f12" type="key" code="293" ascii="326" modifiers="" />
<event name="del" type="key" code="127" ascii="0" modifiers="" />
<event name="ctrl" type="modifier" modifiers="ctrl" />
<event name="alt" type="modifier" modifiers="alt" />
<event name="shift" type="modifier" modifiers="shift" />
<event name="symbols" type="switch_mode" mode="lowercase" />
<event name="caps" type="switch_mode" mode="uppercasesymbols" />
<event name="backspace" type="key" code="8" ascii="8" modifiers="" />
<event name="enter" type="key" code="13" ascii="13" modifiers="" />
<event name="quote" type="key" code="34" ascii="34" modifiers="" />
<event name="£" type="key" code="163" ascii="163" modifiers="" />
<event name="$" type="key" code="36" ascii="36" modifiers="" />
<event name="%" type="key" code="37" ascii="37" modifiers="" />
<event name="^" type="key" code="94" ascii="94" modifiers="" />
<event name="&amp;" type="key" code="38" ascii="38" modifiers="" />
<event name="*" type="key" code="42" ascii="42" modifiers="" />
<event name="(" type="key" code="40" ascii="40" modifiers="" />
<event name=")" type="key" code="41" ascii="41" modifiers="" />
<event name="_" type="key" code="95" ascii="95" modifiers="" />
<event name="+" type="key" code="43" ascii="43" modifiers="" />
<event name="¬" type="key" code="172" ascii="172" modifiers="" />
<event name="!" type="key" code="33" ascii="33" modifiers="" />
<event name="{" type="key" code="123" ascii="123" modifiers="" />
<event name="}" type="key" code="125" ascii="125" modifiers="" />
<event name="~" type="key" code="126" ascii="126" modifiers="" />
<event name=":" type="key" code="58" ascii="58" modifiers="" />
<event name="@" type="key" code="64" ascii="64" modifiers="" />
<event name="&lt;" type="key" code="60" ascii="60" modifiers="" />
<event name="&gt;" type="key" code="62" ascii="62" modifiers="" />
<event name="?" type="key" code="63" ascii="63" modifiers="" />
<event name="space" type="key" code="32" ascii="32" modifiers="" />
<event name="tab" type="key" code="9" ascii="9" modifiers="" />
<event name="a" type="key" code="97" ascii="97" modifiers="" />
<event name="b" type="key" code="98" ascii="98" modifiers="" />
<event name="c" type="key" code="99" ascii="99" modifiers="" />
<event name="d" type="key" code="100" ascii="100" modifiers="" />
<event name="e" type="key" code="101" ascii="101" modifiers="" />
<event name="f" type="key" code="102" ascii="102" modifiers="" />
<event name="g" type="key" code="103" ascii="103" modifiers="" />
<event name="h" type="key" code="104" ascii="104" modifiers="" />
<event name="i" type="key" code="105" ascii="105" modifiers="" />
<event name="j" type="key" code="106" ascii="106" modifiers="" />
<event name="k" type="key" code="107" ascii="107" modifiers="" />
<event name="l" type="key" code="108" ascii="108" modifiers="" />
<event name="m" type="key" code="109" ascii="109" modifiers="" />
<event name="n" type="key" code="110" ascii="110" modifiers="" />
<event name="o" type="key" code="111" ascii="111" modifiers="" />
<event name="p" type="key" code="112" ascii="112" modifiers="" />
<event name="q" type="key" code="113" ascii="113" modifiers="" />
<event name="r" type="key" code="114" ascii="114" modifiers="" />
<event name="s" type="key" code="115" ascii="115" modifiers="" />
<event name="t" type="key" code="116" ascii="116" modifiers="" />
<event name="u" type="key" code="117" ascii="117" modifiers="" />
<event name="v" type="key" code="118" ascii="118" modifiers="" />
<event name="w" type="key" code="119" ascii="119" modifiers="" />
<event name="x" type="key" code="120" ascii="120" modifiers="" />
<event name="y" type="key" code="121" ascii="121" modifiers="" />
<event name="z" type="key" code="122" ascii="122" modifiers="" />
<event name="ok" type="submit" />
<event name="cancel" type="cancel" />
<event name="quit" type="submit" />
<event name="delete" type="delete" />
</mode>
<!-- Uppercase Symbols -->
<mode name="uppercasesymbols" resolutions="320x240">
<layout resolution="320x240" bitmap="uppercase-symbols320x240.bmp" transparent_color="255,0,255">
<map>
<area shape="rect" coords="13,8,306,20" target="display_area" />
<area shape="rect" coords="9,26,25,42" target="esc" />
<area shape="rect" coords="50,25,67,43" target="f2" />
<area shape="rect" coords="29,24,46,43" target="f1" />
<area shape="rect" coords="71,26,88,44" target="f3" />
<area shape="rect" coords="90,25,107,43" target="f4" />
<area shape="rect" coords="111,26,128,44" target="f5" />
<area shape="rect" coords="132,26,149,44" target="f6" />
<area shape="rect" coords="153,25,170,44" target="f7" />
<area shape="rect" coords="173,26,190,44" target="f8" />
<area shape="rect" coords="194,24,211,43" target="f9" />
<area shape="rect" coords="215,26,231,44" target="f10" />
<area shape="rect" coords="235,26,253,43" target="f11" />
<area shape="rect" coords="255,26,272,45" target="f12" />
<area shape="rect" coords="276,27,310,43" target="del" />
<area shape="rect" coords="8,47,26,64" target="¬" />
<area shape="rect" coords="28,47,45,64" target="!" />
<area shape="rect" coords="50,47,67,65" target="quote" />
<area shape="rect" coords="70,46,87,65" target="£" />
<area shape="rect" coords="91,46,108,64" target="$" />
<area shape="rect" coords="111,46,129,65" target="%" />
<area shape="rect" coords="132,47,149,65" target="^" />
<area shape="rect" coords="152,47,170,64" target="&amp;" />
<area shape="rect" coords="174,46,191,63" target="*" />
<area shape="rect" coords="194,47,211,65" target="(" />
<area shape="rect" coords="215,46,232,64" target=")" />
<area shape="rect" coords="235,47,252,65" target="_" />
<area shape="rect" coords="255,46,272,65" target="+" />
<area shape="rect" coords="276,46,299,65" target="delete" />
<area shape="rect" coords="300,46,311,65" target="backspace" />
<area shape="rect" coords="8,68,32,85" target="tab" />
<area shape="rect" coords="36,68,53,85" target="Q" />
<area shape="rect" coords="57,68,75,86" target="W" />
<area shape="rect" coords="78,67,94,85" target="E" />
<area shape="rect" coords="98,67,115,85" target="R" />
<area shape="rect" coords="119,67,136,85" target="T" />
<area shape="rect" coords="141,68,158,86" target="Y" />
<area shape="rect" coords="161,67,179,86" target="U" />
<area shape="rect" coords="182,67,199,86" target="I" />
<area shape="rect" coords="202,67,220,85" target="O" />
<area shape="rect" coords="223,68,240,86" target="P" />
<area shape="rect" coords="244,68,261,86" target="{" />
<area shape="rect" coords="264,67,282,86" target="}" />
<area shape="rect" coords="284,68,309,86" target="~" />
<area shape="rect" coords="8,89,41,106" target="caps" />
<area shape="rect" coords="44,88,63,107" target="A" />
<area shape="rect" coords="65,88,84,106" target="S" />
<area shape="rect" coords="86,89,104,107" target="D" />
<area shape="rect" coords="107,89,124,107" target="F" />
<area shape="rect" coords="128,89,145,107" target="G" />
<area shape="rect" coords="149,88,165,107" target="H" />
<area shape="rect" coords="169,89,186,107" target="J" />
<area shape="rect" coords="189,89,207,107" target="K" />
<area shape="rect" coords="210,89,228,107" target="L" />
<area shape="rect" coords="231,88,249,106" target=":" />
<area shape="rect" coords="251,89,269,107" target="@" />
<area shape="rect" coords="273,89,311,106" target="enter" />
<area shape="rect" coords="9,110,50,127" target="shift" />
<area shape="rect" coords="58,110,75,128" target="z" />
<area shape="rect" coords="79,110,96,128" target="x" />
<area shape="rect" coords="99,109,116,127" target="c" />
<area shape="rect" coords="120,110,138,128" target="v" />
<area shape="rect" coords="141,109,157,127" target="b" />
<area shape="rect" coords="162,110,179,128" target="n" />
<area shape="rect" coords="182,110,199,128" target="m" />
<area shape="rect" coords="202,110,219,128" target="&lt;" />
<area shape="rect" coords="223,110,241,128" target="&gt;" />
<area shape="rect" coords="243,110,261,128" target="?" />
<area shape="rect" coords="271,109,311,128" target="symbols" />
<area shape="rect" coords="9,130,33,148" target="ctrl" />
<area shape="rect" coords="38,130,61,147" target="alt" />
<area shape="rect" coords="67,130,262,148" target="space" />
<area shape="rect" coords="269,131,288,150" target="ok" />
<area shape="rect" coords="292,131,311,150" target="cancel" />
</map>
</layout>
<event name="esc" type="key" code="27" ascii="27" modifiers="" />
<event name="f1" type="key" code="282" ascii="315" modifiers="" />
<event name="f2" type="key" code="283" ascii="316" modifiers="" />
<event name="f3" type="key" code="284" ascii="317" modifiers="" />
<event name="f4" type="key" code="285" ascii="318" modifiers="" />
<event name="f5" type="key" code="286" ascii="319" modifiers="" />
<event name="f6" type="key" code="287" ascii="320" modifiers="" />
<event name="f7" type="key" code="288" ascii="321" modifiers="" />
<event name="f8" type="key" code="289" ascii="322" modifiers="" />
<event name="f9" type="key" code="290" ascii="323" modifiers="" />
<event name="f10" type="key" code="291" ascii="324" modifiers="" />
<event name="f11" type="key" code="292" ascii="325" modifiers="" />
<event name="f12" type="key" code="293" ascii="326" modifiers="" />
<event name="del" type="key" code="127" ascii="0" modifiers="" />
<event name="ctrl" type="modifier" modifiers="ctrl" />
<event name="alt" type="modifier" modifiers="alt" />
<event name="shift" type="switch_mode" mode="shiftlowercase" />
<event name="caps" type="switch_mode" mode="lowercasesymbols" />
<event name="symbols" type="switch_mode" mode="uppercase" />
<event name="backspace" type="key" code="8" ascii="8" modifiers="" />
<event name="enter" type="key" code="13" ascii="13" modifiers="" />
<event name="quote" type="key" code="34" ascii="34" modifiers="" />
<event name="£" type="key" code="163" ascii="163" modifiers="" />
<event name="$" type="key" code="36" ascii="36" modifiers="" />
<event name="%" type="key" code="37" ascii="37" modifiers="" />
<event name="^" type="key" code="94" ascii="94" modifiers="" />
<event name="&amp;" type="key" code="38" ascii="38" modifiers="" />
<event name="*" type="key" code="42" ascii="42" modifiers="" />
<event name="(" type="key" code="40" ascii="40" modifiers="" />
<event name=")" type="key" code="41" ascii="41" modifiers="" />
<event name="_" type="key" code="95" ascii="95" modifiers="" />
<event name="+" type="key" code="43" ascii="43" modifiers="" />
<event name="¬" type="key" code="172" ascii="172" modifiers="" />
<event name="!" type="key" code="33" ascii="33" modifiers="" />
<event name="{" type="key" code="123" ascii="123" modifiers="" />
<event name="}" type="key" code="125" ascii="125" modifiers="" />
<event name="~" type="key" code="126" ascii="126" modifiers="" />
<event name=":" type="key" code="58" ascii="58" modifiers="" />
<event name="@" type="key" code="64" ascii="64" modifiers="" />
<event name="&lt;" type="key" code="60" ascii="60" modifiers="" />
<event name="&gt;" type="key" code="62" ascii="62" modifiers="" />
<event name="?" type="key" code="63" ascii="63" modifiers="" />
<event name="space" type="key" code="32" ascii="32" modifiers="" />
<event name="tab" type="key" code="9" ascii="9" modifiers="" />
<event name="A" type="key" code="97" ascii="65" modifiers="shift" />
<event name="B" type="key" code="98" ascii="66" modifiers="shift" />
<event name="C" type="key" code="99" ascii="67" modifiers="shift" />
<event name="D" type="key" code="100" ascii="68" modifiers="shift" />
<event name="E" type="key" code="101" ascii="69" modifiers="shift" />
<event name="F" type="key" code="102" ascii="70" modifiers="shift" />
<event name="G" type="key" code="103" ascii="71" modifiers="shift" />
<event name="H" type="key" code="104" ascii="72" modifiers="shift" />
<event name="I" type="key" code="105" ascii="73" modifiers="shift" />
<event name="J" type="key" code="106" ascii="74" modifiers="shift" />
<event name="K" type="key" code="107" ascii="75" modifiers="shift" />
<event name="L" type="key" code="108" ascii="76" modifiers="shift" />
<event name="M" type="key" code="109" ascii="77" modifiers="shift" />
<event name="N" type="key" code="110" ascii="78" modifiers="shift" />
<event name="O" type="key" code="111" ascii="79" modifiers="shift" />
<event name="P" type="key" code="112" ascii="80" modifiers="shift" />
<event name="Q" type="key" code="113" ascii="81" modifiers="shift" />
<event name="R" type="key" code="114" ascii="82" modifiers="shift" />
<event name="S" type="key" code="115" ascii="83" modifiers="shift" />
<event name="T" type="key" code="116" ascii="84" modifiers="shift" />
<event name="U" type="key" code="117" ascii="85" modifiers="shift" />
<event name="V" type="key" code="118" ascii="86" modifiers="shift" />
<event name="W" type="key" code="119" ascii="87" modifiers="shift" />
<event name="X" type="key" code="120" ascii="88" modifiers="shift" />
<event name="Y" type="key" code="121" ascii="89" modifiers="shift" />
<event name="Z" type="key" code="122" ascii="90" modifiers="shift" />
<event name="0" type="key" code="48" ascii="48" modifiers="" />
<event name="1" type="key" code="49" ascii="49" modifiers="" />
<event name="2" type="key" code="50" ascii="50" modifiers="" />
<event name="3" type="key" code="51" ascii="51" modifiers="" />
<event name="4" type="key" code="52" ascii="52" modifiers="" />
<event name="5" type="key" code="53" ascii="53" modifiers="" />
<event name="6" type="key" code="54" ascii="54" modifiers="" />
<event name="7" type="key" code="55" ascii="55" modifiers="" />
<event name="8" type="key" code="56" ascii="56" modifiers="" />
<event name="9" type="key" code="57" ascii="57" modifiers="" />
<event name="ok" type="submit" />
<event name="cancel" type="cancel" />
<event name="quit" type="submit" />
<event name="delete" type="delete" />
</mode>
</keyboard>

0
backends/vkeybd/packs/vkeybdpack.py Normal file → Executable file
View file

View file

@ -98,7 +98,7 @@ bool VirtualKeyboard::openPack(const String &packName, const FSNode &node) {
return false;
}
} else {
warning("Could not find %s.xml file in %s.zip keyboard pack", packName.c_str(), packName.c_str());
warning("Could not find %s.xml file in %s.zip virtual keyboard pack", packName.c_str(), packName.c_str());
delete _fileArchive;
_fileArchive = 0;
return false;
@ -132,15 +132,15 @@ bool VirtualKeyboard::loadKeyboardPack(const String &packName) {
_loaded = _parser->parse();
if (_loaded) {
debug("Keyboard pack '%s' loaded successfully", packName.c_str());
debug("Virtual keyboard pack '%s' loaded successfully", packName.c_str());
} else {
warning("Error parsing the keyboard pack '%s'", packName.c_str());
warning("Error parsing the virtual keyboard pack '%s'", packName.c_str());
delete _fileArchive;
_fileArchive = 0;
}
} else {
warning("Keyboard pack not found");
warning("Virtual keyboard disabled due to missing pack file");
}
return _loaded;
@ -205,7 +205,7 @@ void VirtualKeyboard::switchMode(Mode *newMode) {
void VirtualKeyboard::switchMode(const String &newMode) {
if (!_modes.contains(newMode)) {
warning("Keyboard mode '%s' unknown", newMode.c_str());
warning("Virtual keyboard mode '%s' unknown", newMode.c_str());
} else {
switchMode(&_modes[newMode]);
}
@ -227,7 +227,7 @@ void VirtualKeyboard::handleMouseUp(int16 x, int16 y) {
void VirtualKeyboard::show() {
if (!_loaded) {
warning("Virtual keyboard not loaded");
debug(1, "VirtualKeyboard::show() - Virtual keyboard not loaded");
return;
} else {
_kbdGUI->checkScreenChanged();

View file

@ -209,7 +209,9 @@ static Common::Error runGame(const EnginePlugin *plugin, OSystem &system, const
Common::StringTokenizer tokenizer(edebuglevels, " ,");
while (!tokenizer.empty()) {
Common::String token = tokenizer.nextToken();
if (!DebugMan.enableDebugChannel(token))
if (token.equalsIgnoreCase("all"))
DebugMan.enableAllDebugChannels();
else if (!DebugMan.enableDebugChannel(token))
warning(_("Engine does not support debug level '%s'"), token.c_str());
}

View file

@ -30,23 +30,45 @@ namespace Common {
List<Event> DefaultEventMapper::mapEvent(const Event &ev, EventSource *source) {
List<Event> events;
Event mappedEvent;
#ifdef ENABLE_VKEYBD
// Trigger virtual keyboard on long press of more than 1 second
// of middle mouse button.
const uint32 vkeybdTime = 1000;
static bool vkeybd = false;
static uint32 vkeybdThen = 0;
if (ev.type == EVENT_MBUTTONDOWN) {
vkeybdThen = g_system->getMillis();
}
if (ev.type == EVENT_MBUTTONUP) {
if ((g_system->getMillis() - vkeybdThen) >= vkeybdTime) {
mappedEvent.type = EVENT_VIRTUAL_KEYBOARD;
// Avoid blocking event from engine.
addDelayedEvent(100, ev);
}
}
#endif
if (ev.type == EVENT_KEYDOWN) {
if (ev.kbd.hasFlags(KBD_CTRL) && ev.kbd.keycode == KEYCODE_F5) {
mappedEvent.type = EVENT_MAINMENU;
}
#ifdef ENABLE_VKEYBD
else if (ev.kbd.keycode == KEYCODE_F7 && ev.kbd.hasFlags(0)) {
else if (ev.kbd.hasFlags(KBD_CTRL) && ev.kbd.keycode == KEYCODE_F7) {
mappedEvent.type = EVENT_VIRTUAL_KEYBOARD;
// Avoid blocking F7 events from engine.
// Avoid blocking CTRL-F7 events from engine.
addDelayedEvent(100, ev);
}
#endif
#ifdef ENABLE_KEYMAPPER
else if (ev.kbd.keycode == KEYCODE_F8 && ev.kbd.hasFlags(0)) {
else if (ev.kbd.hasFlags(KBD_CTRL) && ev.kbd.keycode == KEYCODE_F8) {
mappedEvent.type = EVENT_KEYMAPPER_REMAP;
// Avoid blocking F8 events from engine.
// Avoid blocking CTRL-F8 events from engine.
addDelayedEvent(100, ev);
}
#endif

View file

@ -52,6 +52,9 @@ public:
/** Skip the specified amount of bits. */
virtual void skip(uint32 n) = 0;
/** Skip the bits to closest data value border. */
virtual void align() = 0;
/** Read a bit from the bit stream. */
virtual uint32 getBit() = 0;
@ -276,6 +279,12 @@ public:
getBit();
}
/** Skip the bits to closest data value border. */
void align() {
while (_inValue)
getBit();
}
/** Return the stream position in bits. */
uint32 pos() const {
if (_stream->pos() == 0)

View file

@ -73,7 +73,7 @@ void DCT::calc(float *data) {
void DCT::calcDCTI(float *data) {
int n = 1 << _bits;
float next = -0.5 * (data[0] - data[n]);
float next = -0.5f * (data[0] - data[n]);
for (int i = 0; i < (n / 2); i++) {
float tmp1 = data[i ];
@ -87,7 +87,7 @@ void DCT::calcDCTI(float *data) {
next += c;
tmp1 = (tmp1 + tmp2) * 0.5;
tmp1 = (tmp1 + tmp2) * 0.5f;
data[i ] = tmp1 - s;
data[n - i] = tmp1 + s;
@ -113,7 +113,7 @@ void DCT::calcDCTII(float *data) {
s *= tmp1 - tmp2;
tmp1 = (tmp1 + tmp2) * 0.5;
tmp1 = (tmp1 + tmp2) * 0.5f;
data[i ] = tmp1 + s;
data[n - i - 1] = tmp1 - s;
@ -121,7 +121,7 @@ void DCT::calcDCTII(float *data) {
_rdft->calc(data);
float next = data[1] * 0.5;
float next = data[1] * 0.5f;
data[1] *= -1;
@ -143,7 +143,7 @@ void DCT::calcDCTIII(float *data) {
int n = 1 << _bits;
float next = data[n - 1];
float inv_n = 1.0 / n;
float inv_n = 1.0f / n;
for (int i = n - 2; i >= 2; i -= 2) {
float val1 = data[i ];
@ -184,7 +184,7 @@ void DCT::calcDSTI(float *data) {
float s = SIN(n, 2 * i);
s *= tmp1 + tmp2;
tmp1 = (tmp1 - tmp2) * 0.5;
tmp1 = (tmp1 - tmp2) * 0.5f;
data[i ] = s + tmp1;
data[n - i] = s - tmp1;
@ -194,7 +194,7 @@ void DCT::calcDSTI(float *data) {
_rdft->calc(data);
data[0] *= 0.5;
data[0] *= 0.5f;
for (int i = 1; i < (n - 2); i += 2) {
data[i + 1] += data[i - 1];

View file

@ -95,8 +95,6 @@ public:
*/
bool disableDebugChannel(const String &name);
typedef List<DebugChannel> DebugChannelList;
/**
@ -106,6 +104,15 @@ public:
*/
DebugChannelList listDebugChannels();
/**
* Enable all debug channels.
*/
void enableAllDebugChannels();
/**
* Disable all debug channels.
*/
void disableAllDebugChannels();
/**
* Test whether the given debug channel is enabled.

View file

@ -46,6 +46,11 @@ struct DebugLevelComperator {
} // end of anonymous namespace
bool DebugManager::addDebugChannel(uint32 channel, const String &name, const String &description) {
if (name.equalsIgnoreCase("all")) {
warning("Debug channel 'all' is reserved for internal use");
return false;
}
if (gDebugChannels.contains(name))
warning("Duplicate declaration of engine debug channel '%s'", name.c_str());
@ -85,7 +90,6 @@ bool DebugManager::disableDebugChannel(const String &name) {
}
}
DebugManager::DebugChannelList DebugManager::listDebugChannels() {
DebugChannelList tmp;
for (DebugChannelMap::iterator i = gDebugChannels.begin(); i != gDebugChannels.end(); ++i)
@ -95,6 +99,16 @@ DebugManager::DebugChannelList DebugManager::listDebugChannels() {
return tmp;
}
void DebugManager::enableAllDebugChannels() {
for (DebugChannelMap::iterator i = gDebugChannels.begin(); i != gDebugChannels.end(); ++i)
enableDebugChannel(i->_value.name);
}
void DebugManager::disableAllDebugChannels() {
for (DebugChannelMap::iterator i = gDebugChannels.begin(); i != gDebugChannels.end(); ++i)
disableDebugChannel(i->_value.name);
}
bool DebugManager::isDebugChannelEnabled(uint32 channel) {
// Debug level 11 turns on all special debug level messages
if (gDebugLevel == 11)

View file

@ -92,8 +92,7 @@
return __builtin_bswap32(a);
}
// test for MSVC 7 or newer
#elif defined(_MSC_VER) && _MSC_VER >= 1300
#elif defined(_MSC_VER)
FORCEINLINE uint32 SWAP_BYTES_32(uint32 a) {
return _byteswap_ulong(a);

View file

@ -108,11 +108,11 @@ inline int intLog2(uint32 v) {
#endif
inline float rad2deg(float rad) {
return rad * 180.0 / M_PI;
return rad * 180.0f / (float)M_PI;
}
inline float deg2rad(float deg) {
return deg * M_PI / 180.0;
return deg * (float)M_PI / 180.0f;
}
} // End of namespace Common

View file

@ -49,8 +49,8 @@ RDFT::~RDFT() {
void RDFT::calc(float *data) {
const int n = 1 << _bits;
const float k1 = 0.5;
const float k2 = 0.5 - _inverse;
const float k1 = 0.5f;
const float k2 = 0.5f - _inverse;
if (!_inverse) {
_fft->permute((Complex *)data);

View file

@ -44,8 +44,8 @@ private:
* and you specialise makeInstance to return an instance of a subclass.
*/
//template<class T>
#if defined(_WIN32_WCE) || defined(_MSC_VER) || defined(__WINS__)
//FIXME evc4 and msvc7 doesn't like it as private member
#if defined(__WINS__)
//FIXME verify if __WINS__ needs this still
public:
#endif
static T *makeInstance() {

View file

@ -72,7 +72,7 @@ template<typename T> inline void SWAP(T &a, T &b) { T tmp = a; a = b; b = tmp; }
# define SCUMMVM_CURRENT_FUNCTION __PRETTY_FUNCTION__
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901)
# define SCUMMVM_CURRENT_FUNCTION __func__
#elif defined(_MSC_VER) && _MSC_VER >= 1300
#elif defined(_MSC_VER)
# define SCUMMVM_CURRENT_FUNCTION __FUNCTION__
#else
# define SCUMMVM_CURRENT_FUNCTION "<unknown>"

51
configure vendored
View file

@ -2145,6 +2145,12 @@ case $_host_os in
LDFLAGS="$LDFLAGS -L$ANDROID_NDK/sources/cxx-stl/gnu-libstdc++/`$CXX -dumpversion`/libs/$ABI/"
LIBS="$LIBS -lsupc++"
add_line_to_config_mk "ANDROID_SDK = $ANDROID_SDK"
if test -d "$ANDROID_SDK"/build-tools; then
_build_tools_version=`cd "$ANDROID_SDK"/build-tools && ls -1 | sort -rn | head -1`
add_line_to_config_mk "ANDROID_BTOOLS = build-tools/$_build_tools_version"
else
add_line_to_config_mk "ANDROID_BTOOLS = platform-tools"
fi
_seq_midi=no
;;
beos*)
@ -2191,6 +2197,49 @@ case $_host_os in
echo "Set staticlib-prefix to ${_staticlibpath}"
fi
fi
# Fink
# There is no way to get the prefix, so implementing a hack here
fink_version=`fink -V 2>/dev/null`
if test "$?" -eq 0; then
fink_version="`echo "${fink_version}" | sed -ne 's/Package manager version: \([0-9.]*\)/\1/gp'`"
echo_n "You seem to be running Fink version ${fink_version}..."
fink_prefix=`which fink`
# strip off /bin/fink from /sw/bin/port
fink_prefix=`dirname ${fink_prefix}`
fink_prefix=`dirname ${fink_prefix}`
echo "adding ${fink_prefix} to paths"
LDFLAGS="-L${fink_prefix}/lib $LDFLAGS"
CXXFLAGS="-I${fink_prefix}/include $CXXFLAGS"
if test -z "$_staticlibpath"; then
_staticlibpath=${fink_prefix}
echo "Set staticlib-prefix to ${_staticlibpath}"
fi
fi
# Homebrew
brew_version=`brew -v 2>/dev/null`
if test "$?" -eq 0; then
brew_version="`echo "${brew_version}" | sed -ne 's/Homebrew \([0-9.]*\)/\1/gp'`"
echo_n "You seem to be running Homebrew version ${brew_version}..."
brew_prefix=`brew --prefix`
echo "adding ${brew_prefix} to paths"
LDFLAGS="-L${brew_prefix}/lib $LDFLAGS"
CXXFLAGS="-I${brew_prefix}/include $CXXFLAGS"
if test -z "$_staticlibpath"; then
_staticlibpath=${brew_prefix}
echo "Set staticlib-prefix to ${_staticlibpath}"
fi
fi
# If _staticlibpath is not set yet try first /sw (fink) then /usr/local
# (the macports case is handled above).
if test -z "$_staticlibpath"; then
@ -2736,6 +2785,8 @@ if test -n "$_host"; then
_mt32emu=no
_timidity=no
_vkeybd=yes
_eventrec=no
_port_mk="backends/platform/sdl/ps3/ps3.mk"
;;
psp)
_backend="psp"

View file

@ -175,7 +175,7 @@ int main(int argc, char *argv[]) {
msvcVersion = atoi(argv[++i]);
if (msvcVersion != 8 && msvcVersion != 9 && msvcVersion != 10 && msvcVersion != 11 && msvcVersion != 12) {
if (msvcVersion != 9 && msvcVersion != 10 && msvcVersion != 11 && msvcVersion != 12) {
std::cerr << "ERROR: Unsupported version: \"" << msvcVersion << "\" passed to \"--msvc-version\"!\n";
return -1;
}
@ -526,7 +526,7 @@ int main(int argc, char *argv[]) {
projectWarnings["m4"].push_back("4355");
if (msvcVersion == 8 || msvcVersion == 9)
if (msvcVersion == 9)
provider = new CreateProjectTool::VisualStudioProvider(globalWarnings, projectWarnings, msvcVersion);
else
provider = new CreateProjectTool::MSBuildProvider(globalWarnings, projectWarnings, msvcVersion);
@ -619,10 +619,10 @@ void displayHelp(const char *exe) {
"\n"
"MSVC specific settings:\n"
" --msvc-version version set the targeted MSVC version. Possible values:\n"
" 8 stands for \"Visual Studio 2005\"\n"
" 9 stands for \"Visual Studio 2008\"\n"
" 10 stands for \"Visual Studio 2010\"\n"
" 11 stands for \"Visual Studio 2012\"\n"
" 12 stands for \"Visual Studio 2013\"\n"
" The default is \"9\", thus \"Visual Studio 2008\"\n"
" --build-events Run custom build events as part of the build\n"
" (default: false)\n"

View file

@ -61,7 +61,6 @@
<Command>@echo off
xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc10\"
xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc9\"
xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc8\"
xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\codeblocks\"
xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\iphone\"</Command>
</PostBuildEvent>
@ -87,7 +86,6 @@ xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\iphone\"</Command>
<Command>@echo off
xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc10\"
xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc9\"
xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc8\"
xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\codeblocks\"
xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\iphone\"</Command>
</PostBuildEvent>

View file

@ -66,7 +66,6 @@
xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc11\"
xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc10\"
xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc9\"
xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc8\"
xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\codeblocks\"
xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\iphone\"</Command>
</PostBuildEvent>
@ -93,7 +92,6 @@ xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\iphone\"</Command>
xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc11\"
xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc10\"
xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc9\"
xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc8\"
xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\codeblocks\"
xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\iphone\"</Command>
</PostBuildEvent>

View file

@ -66,7 +66,6 @@ xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc12\"
xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc11\"
xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc10\"
xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc9\"
xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc8\"
xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\codeblocks\"
xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\iphone\"</Command>
</PostBuildEvent>
@ -94,7 +93,6 @@ xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc12\"
xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc11\"
xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc10\"
xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc9\"
xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc8\"
xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\codeblocks\"
xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\iphone\"</Command>
</PostBuildEvent>

View file

@ -1,20 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "create_project", "create_project.vcproj", "{CF177559-077D-4A08-AABE-BE0FD35F6C63}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CF177559-077D-4A08-AABE-BE0FD35F6C63}.Debug|Win32.ActiveCfg = Debug|Win32
{CF177559-077D-4A08-AABE-BE0FD35F6C63}.Debug|Win32.Build.0 = Debug|Win32
{CF177559-077D-4A08-AABE-BE0FD35F6C63}.Release|Win32.ActiveCfg = Release|Win32
{CF177559-077D-4A08-AABE-BE0FD35F6C63}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View file

@ -1,251 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="create_project"
ProjectGUID="{CF177559-077D-4A08-AABE-BE0FD35F6C63}"
RootNamespace="create_project"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
WarningLevel="4"
DebugInformationFormat="4"
DisableSpecificWarnings="4003;4512;4127"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="Rpcrt4.lib"
GenerateDebugInformation="true"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
WarningLevel="3"
DebugInformationFormat="3"
DisableSpecificWarnings="4003;4512;4127"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="Rpcrt4.lib"
GenerateDebugInformation="true"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\create_project.cpp"
>
</File>
<File
RelativePath="..\codeblocks.cpp"
>
</File>
<File
RelativePath="..\msvc.cpp"
>
</File>
<File
RelativePath="..\msbuild.cpp"
>
</File>
<File
RelativePath="..\visualstudio.cpp"
>
</File>
<File
RelativePath="..\xcode.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\create_project.h"
>
</File>
<File
RelativePath="..\codeblocks.h"
>
</File>
<File
RelativePath="..\config.h"
>
</File>
<File
RelativePath="..\msvc.h"
>
</File>
<File
RelativePath="..\msbuild.h"
>
</File>
<File
RelativePath="..\visualstudio.h"
>
</File>
<File
RelativePath="..\xcode.h"
>
</File>
</Filter>
<Filter
Name="Scripts"
Filter="vbs;cmd"
UniqueIdentifier="{45B110C8-4C64-4677-8ED6-F9A93C6D55A0}"
>
<File
RelativePath="..\scripts\prebuild.cmd"
>
</File>
<File
RelativePath="..\scripts\postbuild.cmd"
>
</File>
<File
RelativePath="..\scripts\revision.vbs"
>
</File>
<File
RelativePath="..\scripts\installer.vbs"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -26,6 +26,7 @@ echo.
xcopy /F /Y "%~4/lib/%~3/SDL.dll" "%~2" 1>NUL 2>&1
xcopy /F /Y "%~4/lib/%~3/freetype6.dll" "%~2" 1>NUL 2>&1
xcopy /F /Y "%~1/backends/vkeybd/packs/vkeybd_default.zip" "%~2" 1>NUL 2>&1
xcopy /F /Y "%~1/backends/vkeybd/packs/vkeybd_small.zip" "%~2" 1>NUL 2>&1
REM ResidualVM not support it:
REM xcopy /F /Y "%~1/gui/themes/translations.dat" "%~2" 1>NUL 2>&1

View file

@ -29,7 +29,7 @@
namespace CreateProjectTool {
//////////////////////////////////////////////////////////////////////////
// Visual Studio Provider (Visual Studio 2005 & 2008)
// Visual Studio Provider (Visual Studio 2008)
//////////////////////////////////////////////////////////////////////////
VisualStudioProvider::VisualStudioProvider(StringList &global_warnings, std::map<std::string, StringList> &project_warnings, const int version)
@ -48,9 +48,6 @@ int VisualStudioProvider::getVisualStudioVersion() {
if (_version == 9)
return 2008;
if (_version == 8)
return 2005;
error("Unsupported version passed to getVisualStudioVersion");
}
@ -70,7 +67,6 @@ void VisualStudioProvider::createProjectFile(const std::string &name, const std:
"\tRootNamespace=\"" << name << "\"\n"
"\tKeyword=\"Win32Proj\"\n";
if (_version >= 9)
project << "\tTargetFrameworkVersion=\"131072\"\n";
project << "\t>\n"

View file

@ -1,105 +0,0 @@
@echo off
echo.
echo Automatic creation of the MSVC9 project files
echo.
if "%~1"=="/stable" goto stable
if "%~1"=="/STABLE" goto stable
if "%~1"=="/all" goto all
if "%~1"=="/ALL" goto all
if "%~1"=="/tools" goto tools
if "%~1"=="/TOOLS" goto tools
if "%~1"=="/tests" goto tests
if "%~1"=="/TESTS" goto tests
if "%~1"=="/clean" goto clean_check
if "%~1"=="/CLEAN" goto clean_check
if "%~1"=="/help" goto command_help
if "%~1"=="/HELP" goto command_help
if "%~1"=="/?" goto command_help
if "%~1"=="" goto check_tool
echo Invalid command parameter: %~1
echo.
:command_help
echo Valid command parameters are:
echo stable Generated stable engines project files
echo all Generate all engines project files
echo tools Generate project files for the devtools
echo clean Clean generated project files
echo help Show help message
goto done
:check_tool
if not exist create_project.exe goto no_tool
:question
echo.
set batchanswer=S
set /p batchanswer="Enable stable engines only, or all engines? (S/a)"
if "%batchanswer%"=="s" goto stable
if "%batchanswer%"=="S" goto stable
if "%batchanswer%"=="a" goto all
if "%batchanswer%"=="A" goto all
goto question
:no_tool
echo create_project.exe not found in the current folder.
echo You need to build it first and copy it in this
echo folder
goto done
:all
echo.
echo Creating project files with all engines enabled (stable and unstable)
echo.
create_project ..\.. --enable-all-engines --msvc --msvc-version 8
goto done
:stable
echo.
echo Creating normal project files, with only the stable engines enabled
echo.
create_project ..\.. --msvc --msvc-version 8
goto done
:tools
echo.
echo Creating tools project files
echo.
create_project ..\.. --tools --msvc --msvc-version 8
goto done
:tests
echo.
echo Creating tests project files
echo.
create_project ..\.. --tests --msvc --msvc-version 8
goto done
:clean_check
echo.
set cleananswer=N
set /p cleananswer="This will remove all project files. Are you sure you want to continue? (N/y)"
if "%cleananswer%"=="n" goto done
if "%cleananswer%"=="N" goto done
if "%cleananswer%"=="y" goto clean
if "%cleananswer%"=="Y" goto clean
goto clean_check
:clean
echo.
echo Removing all project files
del /Q *.vcproj* > NUL 2>&1
del /Q *.vsprops > NUL 2>&1
del /Q *.sln* > NUL 2>&1
del /Q residualvm* > NUL 2>&1
del /Q devtools* > NUL 2>&1
del /Q test_runner.cpp
goto done
:done
echo.
pause

View file

@ -1,6 +0,0 @@
The Visual Studio project files can now be created automatically from the GCC
files using the create_project tool inside the /devtools/create_project folder.
To create the default project files, build create_project.exe, copy it inside
this folder and run the create_msvc8.bat file for a default build. You can run
create_project.exe with no parameters to check the possible command-line options

View file

@ -29,9 +29,9 @@ namespace Grim {
Debugger::Debugger() :
GUI::Debugger() {
DCmd_Register("check_gamedata", WRAP_METHOD(Debugger, cmd_checkFiles));
DCmd_Register("lua_do", WRAP_METHOD(Debugger, cmd_lua_do));
DCmd_Register("emi_jump", WRAP_METHOD(Debugger, cmd_emi_jump));
registerCmd("check_gamedata", WRAP_METHOD(Debugger, cmd_checkFiles));
registerCmd("lua_do", WRAP_METHOD(Debugger, cmd_lua_do));
registerCmd("emi_jump", WRAP_METHOD(Debugger, cmd_emi_jump));
}
Debugger::~Debugger() {
@ -40,9 +40,9 @@ Debugger::~Debugger() {
bool Debugger::cmd_checkFiles(int argc, const char **argv) {
if (MD5Check::checkFiles()) {
DebugPrintf("All files are ok.\n");
debugPrintf("All files are ok.\n");
} else {
DebugPrintf("Some files are corrupted or missing.\n");
debugPrintf("Some files are corrupted or missing.\n");
}
return true;
@ -50,7 +50,7 @@ bool Debugger::cmd_checkFiles(int argc, const char **argv) {
bool Debugger::cmd_lua_do(int argc, const char **argv) {
if (argc < 2) {
DebugPrintf("Usage: lua_do <lua command>\n");
debugPrintf("Usage: lua_do <lua command>\n");
return true;
}
@ -60,7 +60,7 @@ bool Debugger::cmd_lua_do(int argc, const char **argv) {
cmd += " ";
}
cmd.deleteLastChar();
DebugPrintf("Executing command: <%s>\n", cmd.c_str());
debugPrintf("Executing command: <%s>\n", cmd.c_str());
cmd = Common::String::format("__temp_fn__ = function()\n%s\nend\nstart_script(__temp_fn__)", cmd.c_str());
g_grim->debugLua(cmd);
return true;
@ -68,7 +68,7 @@ bool Debugger::cmd_lua_do(int argc, const char **argv) {
bool Debugger::cmd_emi_jump(int argc, const char **argv) {
if (argc < 2) {
DebugPrintf("Usage: jump <jump target>\n");
debugPrintf("Usage: jump <jump target>\n");
return true;
}
Common::String cmd = Common::String::format("dofile(\"_jumpscripts.lua\")\nstart_script(jump_script,\"%s\")", argv[1]);

View file

@ -23,6 +23,8 @@
#ifndef GRIM_DEBUGGER_H
#define GRIM_DEBUGGER_H
#include "common/debug.h"
#include "gui/debugger.h"
namespace Grim {

View file

@ -30,18 +30,18 @@
namespace Myst3 {
Console::Console(Myst3Engine *vm) : GUI::Debugger(), _vm(vm) {
DCmd_Register("infos", WRAP_METHOD(Console, Cmd_Infos));
DCmd_Register("lookAt", WRAP_METHOD(Console, Cmd_LookAt));
DCmd_Register("initScript", WRAP_METHOD(Console, Cmd_InitScript));
DCmd_Register("var", WRAP_METHOD(Console, Cmd_Var));
DCmd_Register("listNodes", WRAP_METHOD(Console, Cmd_ListNodes));
DCmd_Register("run", WRAP_METHOD(Console, Cmd_Run));
DCmd_Register("runOp", WRAP_METHOD(Console, Cmd_RunOp));
DCmd_Register("go", WRAP_METHOD(Console, Cmd_Go));
DCmd_Register("extract", WRAP_METHOD(Console, Cmd_Extract));
DCmd_Register("fillInventory", WRAP_METHOD(Console, Cmd_FillInventory));
DCmd_Register("dumpArchive", WRAP_METHOD(Console, Cmd_DumpArchive));
DCmd_Register("dumpMasks", WRAP_METHOD(Console, Cmd_DumpMasks));
registerCmd("infos", WRAP_METHOD(Console, Cmd_Infos));
registerCmd("lookAt", WRAP_METHOD(Console, Cmd_LookAt));
registerCmd("initScript", WRAP_METHOD(Console, Cmd_InitScript));
registerCmd("var", WRAP_METHOD(Console, Cmd_Var));
registerCmd("listNodes", WRAP_METHOD(Console, Cmd_ListNodes));
registerCmd("run", WRAP_METHOD(Console, Cmd_Run));
registerCmd("runOp", WRAP_METHOD(Console, Cmd_RunOp));
registerCmd("go", WRAP_METHOD(Console, Cmd_Go));
registerCmd("extract", WRAP_METHOD(Console, Cmd_Extract));
registerCmd("fillInventory", WRAP_METHOD(Console, Cmd_FillInventory));
registerCmd("dumpArchive", WRAP_METHOD(Console, Cmd_DumpArchive));
registerCmd("dumpMasks", WRAP_METHOD(Console, Cmd_DumpMasks));
}
Console::~Console() {
@ -49,7 +49,7 @@ Console::~Console() {
void Console::describeScript(const Common::Array<Opcode> &script) {
for(uint j = 0; j < script.size(); j++) {
DebugPrintf("%s", _vm->_scriptEngine->describeOpcode(script[j]).c_str());
debugPrintf("%s", _vm->_scriptEngine->describeOpcode(script[j]).c_str());
}
}
@ -66,7 +66,7 @@ bool Console::Cmd_Infos(int argc, const char **argv) {
roomId = _vm->_db->getRoomId(argv[2]);
if (roomId == 0) {
DebugPrintf("Unknown room name %s\n", argv[2]);
debugPrintf("Unknown room name %s\n", argv[2]);
return true;
}
}
@ -74,17 +74,17 @@ bool Console::Cmd_Infos(int argc, const char **argv) {
NodePtr nodeData = _vm->_db->getNodeData(nodeId, roomId);
if (!nodeData) {
DebugPrintf("No node with id %d\n", nodeId);
debugPrintf("No node with id %d\n", nodeId);
return true;
}
char roomName[8];
_vm->_db->getRoomName(roomName, roomId);
DebugPrintf("node: %s %d ", roomName, nodeId);
debugPrintf("node: %s %d ", roomName, nodeId);
for (uint i = 0; i < nodeData->scripts.size(); i++) {
DebugPrintf("\ninit %d > %s (%s)\n", i,
debugPrintf("\ninit %d > %s (%s)\n", i,
_vm->_state->describeCondition(nodeData->scripts[i].condition).c_str(),
_vm->_state->evaluate(nodeData->scripts[i].condition) ? "true" : "false");
@ -92,14 +92,14 @@ bool Console::Cmd_Infos(int argc, const char **argv) {
}
for (uint i = 0; i < nodeData->hotspots.size(); i++) {
DebugPrintf("\nhotspot %d > %s (%s)\n", i,
debugPrintf("\nhotspot %d > %s (%s)\n", i,
_vm->_state->describeCondition(nodeData->hotspots[i].condition).c_str(),
_vm->_state->evaluate(nodeData->hotspots[i].condition) ? "true" : "false");
for(uint j = 0; j < nodeData->hotspots[i].rects.size(); j++) {
PolarRect &rect = nodeData->hotspots[i].rects[j];
DebugPrintf(" rect > pitch: %d heading: %d width: %d height: %d\n",
debugPrintf(" rect > pitch: %d heading: %d width: %d height: %d\n",
rect.centerPitch, rect.centerHeading, rect.width, rect.height);
}
@ -107,7 +107,7 @@ bool Console::Cmd_Infos(int argc, const char **argv) {
}
for (uint i = 0; i < nodeData->soundScripts.size(); i++) {
DebugPrintf("\nsound %d > %s (%s)\n", i,
debugPrintf("\nsound %d > %s (%s)\n", i,
_vm->_state->describeCondition(nodeData->soundScripts[i].condition).c_str(),
_vm->_state->evaluate(nodeData->soundScripts[i].condition) ? "true" : "false");
@ -115,7 +115,7 @@ bool Console::Cmd_Infos(int argc, const char **argv) {
}
for (uint i = 0; i < nodeData->backgroundSoundScripts.size(); i++) {
DebugPrintf("\nbackground sound %d > %s (%s)\n", i,
debugPrintf("\nbackground sound %d > %s (%s)\n", i,
_vm->_state->describeCondition(nodeData->backgroundSoundScripts[i].condition).c_str(),
_vm->_state->evaluate(nodeData->backgroundSoundScripts[i].condition) ? "true" : "false");
@ -128,15 +128,15 @@ bool Console::Cmd_Infos(int argc, const char **argv) {
bool Console::Cmd_LookAt(int argc, const char **argv) {
if (argc != 1 && argc != 3) {
DebugPrintf("Usage :\n");
DebugPrintf("lookAt pitch heading\n");
debugPrintf("Usage :\n");
debugPrintf("lookAt pitch heading\n");
return true;
}
float pitch = _vm->_state->getLookAtPitch();
float heading = _vm->_state->getLookAtHeading();
DebugPrintf("pitch: %d heading: %d\n", (int)pitch, (int)heading);
debugPrintf("pitch: %d heading: %d\n", (int)pitch, (int)heading);
if (argc >= 3){
_vm->_state->lookAt(atof(argv[1]), atof(argv[2]));
@ -156,9 +156,9 @@ bool Console::Cmd_InitScript(int argc, const char **argv) {
bool Console::Cmd_Var(int argc, const char **argv) {
if (argc != 2 && argc != 3) {
DebugPrintf("Usage :\n");
DebugPrintf("var variable : Display var value\n");
DebugPrintf("var variable value : Change var value\n");
debugPrintf("Usage :\n");
debugPrintf("var variable : Display var value\n");
debugPrintf("var variable value : Change var value\n");
return true;
}
@ -170,7 +170,7 @@ bool Console::Cmd_Var(int argc, const char **argv) {
_vm->_state->setVar(var, value);
}
DebugPrintf("%s: %d\n", _vm->_state->describeVar(var).c_str(), value);
debugPrintf("%s: %d\n", _vm->_state->describeVar(var).c_str(), value);
return true;
}
@ -183,16 +183,16 @@ bool Console::Cmd_ListNodes(int argc, const char **argv) {
roomID = _vm->_db->getRoomId(argv[1]);
if (roomID == 0) {
DebugPrintf("Unknown room name %s\n", argv[1]);
debugPrintf("Unknown room name %s\n", argv[1]);
return true;
}
}
DebugPrintf("Nodes:\n");
debugPrintf("Nodes:\n");
Common::Array<uint16> list = _vm->_db->listRoomNodes(roomID);
for (uint i = 0; i < list.size(); i++) {
DebugPrintf("%d\n", list[i]);
debugPrintf("%d\n", list[i]);
}
return true;
@ -210,7 +210,7 @@ bool Console::Cmd_Run(int argc, const char **argv) {
roomId = _vm->_db->getRoomId(argv[2]);
if (roomId == 0) {
DebugPrintf("Unknown room name %s\n", argv[2]);
debugPrintf("Unknown room name %s\n", argv[2]);
return true;
}
}
@ -222,8 +222,8 @@ bool Console::Cmd_Run(int argc, const char **argv) {
bool Console::Cmd_RunOp(int argc, const char **argv) {
if (argc < 2) {
DebugPrintf("Usage :\n");
DebugPrintf("runOp [opcode] [argument 1] [argument 2] ... : Run specified command\n");
debugPrintf("Usage :\n");
debugPrintf("runOp [opcode] [argument 1] [argument 2] ... : Run specified command\n");
return true;
}
@ -234,8 +234,8 @@ bool Console::Cmd_RunOp(int argc, const char **argv) {
op.args.push_back(atoi(argv[i]));
}
DebugPrintf("Running opcode :\n");
DebugPrintf("%s\n", _vm->_scriptEngine->describeOpcode(op).c_str());
debugPrintf("Running opcode :\n");
debugPrintf("%s\n", _vm->_scriptEngine->describeOpcode(op).c_str());
_vm->_scriptEngine->runSingleOp(op);
@ -244,8 +244,8 @@ bool Console::Cmd_RunOp(int argc, const char **argv) {
bool Console::Cmd_Go(int argc, const char **argv) {
if (argc != 3) {
DebugPrintf("Usage :\n");
DebugPrintf("go [room name] [node id] : Go to node\n");
debugPrintf("Usage :\n");
debugPrintf("go [room name] [node id] : Go to node\n");
return true;
}
@ -253,7 +253,7 @@ bool Console::Cmd_Go(int argc, const char **argv) {
uint16 nodeId = atoi(argv[2]);
if (roomID == 0) {
DebugPrintf("Unknown room name %s\n", argv[1]);
debugPrintf("Unknown room name %s\n", argv[1]);
return true;
}
@ -267,9 +267,9 @@ bool Console::Cmd_Go(int argc, const char **argv) {
bool Console::Cmd_Extract(int argc, const char **argv) {
if (argc != 5) {
DebugPrintf("Extract a file from the game's archives\n");
DebugPrintf("Usage :\n");
DebugPrintf("extract [room] [node id] [face number] [object type]\n");
debugPrintf("Extract a file from the game's archives\n");
debugPrintf("Usage :\n");
debugPrintf("extract [room] [node id] [face number] [object type]\n");
return true;
}
@ -284,7 +284,7 @@ bool Console::Cmd_Extract(int argc, const char **argv) {
const DirectorySubEntry *desc = _vm->getFileDescription(room.c_str(), id, face, type);
if (!desc) {
DebugPrintf("File with room %s, id %d, face %d and type %d does not exist\n", room.c_str(), id, face, type);
debugPrintf("File with room %s, id %d, face %d and type %d does not exist\n", room.c_str(), id, face, type);
return true;
}
@ -304,7 +304,7 @@ bool Console::Cmd_Extract(int argc, const char **argv) {
delete s;
DebugPrintf("File '%s' successfully written\n", filename.c_str());
debugPrintf("File '%s' successfully written\n", filename.c_str());
return true;
}
@ -316,10 +316,10 @@ bool Console::Cmd_FillInventory(int argc, const char **argv) {
bool Console::Cmd_DumpArchive(int argc, const char **argv) {
if (argc != 2) {
DebugPrintf("Extract all the files from a game archive.\n");
DebugPrintf("The destination folder, named 'dump', must exist.\n");
DebugPrintf("Usage :\n");
DebugPrintf("dumpArchive [file name]\n");
debugPrintf("Extract all the files from a game archive.\n");
debugPrintf("The destination folder, named 'dump', must exist.\n");
debugPrintf("Usage :\n");
debugPrintf("dumpArchive [file name]\n");
return true;
}
@ -335,7 +335,7 @@ bool Console::Cmd_DumpArchive(int argc, const char **argv) {
Archive archive;
if (!archive.open(argv[1], multiRoom ? 0 : temp.c_str())) {
DebugPrintf("Can't open archive with name '%s'\n", argv[1]);
debugPrintf("Can't open archive with name '%s'\n", argv[1]);
return true;
}
@ -347,10 +347,10 @@ bool Console::Cmd_DumpArchive(int argc, const char **argv) {
bool Console::Cmd_DumpMasks(int argc, const char **argv) {
if (argc != 1 && argc != 2) {
DebugPrintf("Extract the masks of the faces of a cube node.\n");
DebugPrintf("The destination folder, named 'dump', must exist.\n");
DebugPrintf("Usage :\n");
DebugPrintf("dumpMasks [node]\n");
debugPrintf("Extract the masks of the faces of a cube node.\n");
debugPrintf("The destination folder, named 'dump', must exist.\n");
debugPrintf("Usage :\n");
debugPrintf("dumpMasks [node]\n");
return true;
}
@ -360,23 +360,23 @@ bool Console::Cmd_DumpMasks(int argc, const char **argv) {
nodeId = atoi(argv[1]);
}
DebugPrintf("Extracting masks for node %d:\n", nodeId);
debugPrintf("Extracting masks for node %d:\n", nodeId);
for (uint i = 0; i < 6; i++) {
bool water = dumpFaceMask(nodeId, i, DirectorySubEntry::kWaterEffectMask);
if (water)
DebugPrintf("Face %d: water OK\n", i);
debugPrintf("Face %d: water OK\n", i);
bool effect2 = dumpFaceMask(nodeId, i, DirectorySubEntry::kLavaEffectMask);
if (effect2)
DebugPrintf("Face %d: effect 2 OK\n", i);
debugPrintf("Face %d: effect 2 OK\n", i);
bool magnet = dumpFaceMask(nodeId, i, DirectorySubEntry::kMagneticEffectMask);
if (magnet)
DebugPrintf("Face %d: magnet OK\n", i);
debugPrintf("Face %d: magnet OK\n", i);
if (!water && !effect2 && !magnet)
DebugPrintf("Face %d: No mask found\n", i);
debugPrintf("Face %d: No mask found\n", i);
}
return true;

View file

@ -23,6 +23,8 @@
#ifndef CONSOLE_H_
#define CONSOLE_H_
#include "common/debug.h"
#include "gui/debugger.h"
#include "engines/myst3/myst3.h"

View file

@ -701,7 +701,7 @@ darkenFill(PixelType *ptr, PixelType *end) {
PixelType addA = (PixelType)(3 << (_format.aShift + 6 - _format.aLoss));
while (ptr != end) {
// Darken the colour, and increase the alpha
// Darken the color, and increase the alpha
// (0% -> 75%, 100% -> 100%)
*ptr = (PixelType)(((*ptr & ~mask) >> 2) + addA);
++ptr;

View file

@ -101,7 +101,7 @@ public:
TTFFont();
virtual ~TTFFont();
bool load(Common::SeekableReadStream &stream, int size, uint dpi, bool monochrome, const uint32 *mapping);
bool load(Common::SeekableReadStream &stream, int size, uint dpi, TTFRenderMode renderMode, const uint32 *mapping);
virtual int getFontHeight() const;
@ -135,13 +135,15 @@ private:
bool _allowLateCaching;
void assureCached(uint32 chr) const;
bool _monochrome;
FT_Int32 _loadFlags;
FT_Render_Mode _renderMode;
bool _hasKerning;
};
TTFFont::TTFFont()
: _initialized(false), _face(), _ttfFile(0), _size(0), _width(0), _height(0), _ascent(0),
_descent(0), _glyphs(), _monochrome(false), _hasKerning(false), _allowLateCaching(false) {
_descent(0), _glyphs(), _loadFlags(FT_LOAD_TARGET_NORMAL), _renderMode(FT_RENDER_MODE_NORMAL),
_hasKerning(false), _allowLateCaching(false) {
}
TTFFont::~TTFFont() {
@ -158,7 +160,7 @@ TTFFont::~TTFFont() {
}
}
bool TTFFont::load(Common::SeekableReadStream &stream, int size, uint dpi, bool monochrome, const uint32 *mapping) {
bool TTFFont::load(Common::SeekableReadStream &stream, int size, uint dpi, TTFRenderMode renderMode, const uint32 *mapping) {
if (!g_ttf.isInitialized())
return false;
@ -203,7 +205,22 @@ bool TTFFont::load(Common::SeekableReadStream &stream, int size, uint dpi, bool
return false;
}
_monochrome = monochrome;
switch (renderMode) {
case kTTFRenderModeNormal:
_loadFlags = FT_LOAD_TARGET_NORMAL;
_renderMode = FT_RENDER_MODE_NORMAL;
break;
case kTTFRenderModeLight:
_loadFlags = FT_LOAD_TARGET_LIGHT;
_renderMode = FT_RENDER_MODE_LIGHT;
break;
case kTTFRenderModeMonochrome:
_loadFlags = FT_LOAD_TARGET_MONO;
_renderMode = FT_RENDER_MODE_MONO;
break;
}
FT_Fixed yScale = _face->size->metrics.y_scale;
_ascent = ftCeil26_6(FT_MulFix(_face->ascender, yScale));
@ -413,10 +430,10 @@ bool TTFFont::cacheGlyph(Glyph &glyph, uint32 chr) const {
// We use the light target and render mode to improve the looks of the
// glyphs. It is most noticable in FreeSansBold.ttf, where otherwise the
// 't' glyph looks like it is cut off on the right side.
if (FT_Load_Glyph(_face, slot, (_monochrome ? FT_LOAD_TARGET_MONO : FT_LOAD_TARGET_LIGHT)))
if (FT_Load_Glyph(_face, slot, _loadFlags))
return false;
if (FT_Render_Glyph(_face->glyph, (_monochrome ? FT_RENDER_MODE_MONO : FT_RENDER_MODE_LIGHT)))
if (FT_Render_Glyph(_face->glyph, _renderMode))
return false;
if (_face->glyph->format != FT_GLYPH_FORMAT_BITMAP)
@ -503,10 +520,10 @@ void TTFFont::assureCached(uint32 chr) const {
}
}
Font *loadTTFFont(Common::SeekableReadStream &stream, int size, uint dpi, bool monochrome, const uint32 *mapping) {
Font *loadTTFFont(Common::SeekableReadStream &stream, int size, uint dpi, TTFRenderMode renderMode, const uint32 *mapping) {
TTFFont *font = new TTFFont();
if (!font->load(stream, size, dpi, monochrome, mapping)) {
if (!font->load(stream, size, dpi, renderMode, mapping)) {
delete font;
return 0;
}

View file

@ -33,6 +33,28 @@ namespace Graphics {
class Font;
/**
* This specifies the mode in which TTF glyphs are rendered. This, for example,
* allows to render glyphs fully monochrome, i.e. without any anti-aliasing.
*/
enum TTFRenderMode {
/**
* Standard render mode. Equivalent of FreeType2's FT_RENDER_MODE_NORMAL.
*/
kTTFRenderModeNormal,
/**
* Use lighter hinting. Equivalent of FreeType2's FT_RENDER_MODE_LIGHT.
*/
kTTFRenderModeLight,
/**
* Render fully monochrome. This makes glyph pixels either be fully opaque
* or fully transparent.
*/
kTTFRenderModeMonochrome
};
/**
* Loads a TTF font file from a given data stream object.
*
@ -40,8 +62,7 @@ class Font;
* @param size The point size to load.
* @param dpi The dpi to use for size calculations, by default 72dpi
* are used.
* @param monochrome Whether the font should be loaded in pure monochrome
* mode. In case this is true no aliasing is used.
* @param renderMode FreeType2 mode used to render glyphs. @see TTFRenderMode
* @param mapping A mapping from code points 0-255 into UTF-32 code points.
* This can be used to support various 8bit character sets.
* In case the msb of the UTF-32 code point is set the font
@ -50,7 +71,7 @@ class Font;
* supported.
* @return 0 in case loading fails, otherwise a pointer to the Font object.
*/
Font *loadTTFFont(Common::SeekableReadStream &stream, int size, uint dpi = 0, bool monochrome = false, const uint32 *mapping = 0);
Font *loadTTFFont(Common::SeekableReadStream &stream, int size, uint dpi = 0, TTFRenderMode renderMode = kTTFRenderModeLight, const uint32 *mapping = 0);
void shutdownTTF();

View file

@ -15,6 +15,9 @@ MODULE_OBJS := \
primitives.o \
sjis.o \
surface.o \
transform_struct.o \
transform_tools.o \
transparent_surface.o \
thumbnail.o \
VectorRenderer.o \
VectorRendererSpec.o \

View file

@ -0,0 +1,120 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include "graphics/transform_struct.h"
#include "graphics/transparent_surface.h"
namespace Graphics {
void TransformStruct::init(Common::Point zoom, uint32 angle, Common::Point hotspot, bool alphaDisable, TSpriteBlendMode blendMode, uint32 rgbaMod, bool mirrorX, bool mirrorY, Common::Point offset) {
_zoom = zoom;
_angle = angle;
_hotspot = hotspot;
_blendMode = blendMode;
_rgbaMod = rgbaMod;
_alphaDisable = alphaDisable;
_flip = 0;
_flip += FLIP_H * mirrorX;
_flip += FLIP_V * mirrorY;
_offset = offset;
_numTimesX = 1;
_numTimesY = 1;
}
TransformStruct::TransformStruct(int32 zoomX, int32 zoomY, uint32 angle, int32 hotspotX, int32 hotspotY, TSpriteBlendMode blendMode, uint32 rgbaMod, bool mirrorX, bool mirrorY, int32 offsetX, int32 offsetY) {
init(Common::Point(zoomX, zoomY),
angle,
Common::Point(hotspotX, hotspotY),
false,
blendMode,
rgbaMod,
mirrorX, mirrorY,
Common::Point(offsetX, offsetY));
}
TransformStruct::TransformStruct(float zoomX, float zoomY, uint32 angle, int32 hotspotX, int32 hotspotY, TSpriteBlendMode blendMode, uint32 rgbaMod, bool mirrorX, bool mirrorY, int32 offsetX, int32 offsetY) {
init(Common::Point((int)(zoomX / 100.0 * kDefaultZoomX),
(int)(zoomY / 100.0 * kDefaultZoomY)),
angle,
Common::Point(hotspotX, hotspotY),
false,
blendMode,
rgbaMod,
mirrorX, mirrorY,
Common::Point(offsetX, offsetY));
}
TransformStruct::TransformStruct(int32 zoomX, int32 zoomY, TSpriteBlendMode blendMode, uint32 rgbaMod, bool mirrorX, bool mirrorY) {
init(Common::Point(zoomX, zoomY),
kDefaultAngle,
Common::Point(kDefaultHotspotX, kDefaultHotspotY),
false,
blendMode,
rgbaMod,
mirrorX,
mirrorY,
Common::Point(kDefaultOffsetX, kDefaultOffsetY));
}
TransformStruct::TransformStruct(int32 zoomX, int32 zoomY, uint32 angle, int32 hotspotX, int32 hotspotY) {
init(Common::Point(zoomX, zoomY),
angle,
Common::Point(hotspotX, hotspotY),
true,
BLEND_NORMAL,
kDefaultRgbaMod,
false, false,
Common::Point(kDefaultOffsetX, kDefaultOffsetY));
}
TransformStruct::TransformStruct(int32 numTimesX, int32 numTimesY) {
init(Common::Point(kDefaultZoomX, kDefaultZoomY),
kDefaultAngle,
Common::Point(kDefaultHotspotX, kDefaultHotspotY),
false,
BLEND_NORMAL,
kDefaultRgbaMod,
false, false,
Common::Point(kDefaultOffsetX, kDefaultOffsetY));
_numTimesX = numTimesX;
_numTimesY = numTimesY;
}
TransformStruct::TransformStruct() {
init(Common::Point(kDefaultZoomX, kDefaultZoomY),
kDefaultAngle,
Common::Point(kDefaultHotspotX, kDefaultHotspotY),
true,
BLEND_NORMAL,
kDefaultRgbaMod,
false, false,
Common::Point(kDefaultOffsetX, kDefaultOffsetY));
}
bool TransformStruct::getMirrorX() const {
return (bool)(_flip & FLIP_H);
}
bool TransformStruct::getMirrorY() const {
return (bool)(_flip & FLIP_V);
}
} // End of namespace Graphics

View file

@ -0,0 +1,97 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef GRAPHICS_TRANSFORM_STRUCT_H
#define GRAPHICS_TRANSFORM_STRUCT_H
#include "common/rect.h"
namespace Graphics {
enum TSpriteBlendMode {
BLEND_UNKNOWN = -1,
BLEND_NORMAL = 0,
BLEND_ADDITIVE = 1,
BLEND_SUBTRACTIVE = 2,
NUM_BLEND_MODES
};
/**
* Contains all the required information that define a transform.
* Same source sprite + same TransformStruct = Same resulting sprite.
* Has a number of overloaded constructors to accomodate various argument lists.
*/
const int32 kDefaultZoomX = 100;
const int32 kDefaultZoomY = 100;
const uint32 kDefaultRgbaMod = 0xFFFFFFFF;
const int32 kDefaultHotspotX = 0;
const int32 kDefaultHotspotY = 0;
const int32 kDefaultOffsetX = 0;
const int32 kDefaultOffsetY = 0;
const int32 kDefaultAngle = 0;
struct TransformStruct {
private:
void init(Common::Point zoom, uint32 angle, Common::Point hotspot, bool alphaDisable, TSpriteBlendMode blendMode, uint32 alpha, bool mirrorX, bool mirrorY, Common::Point offset);
public:
TransformStruct(int32 zoomX, int32 zoomY, uint32 angle, int32 hotspotX, int32 hotspotY, TSpriteBlendMode blendMode, uint32 alpha, bool mirrorX = false, bool mirrorY = false, int32 offsetX = 0, int32 offsetY = 0);
TransformStruct(float zoomX, float zoomY, uint32 angle, int32 hotspotX, int32 hotspotY, TSpriteBlendMode blendMode, uint32 alpha, bool mirrorX = false, bool mirrorY = false, int32 offsetX = 0, int32 offsetY = 0);
TransformStruct(int32 zoomX, int32 zoomY, TSpriteBlendMode blendMode, uint32 alpha, bool mirrorX = false, bool mirrorY = false);
TransformStruct(int32 zoomX, int32 zoomY, uint32 angle, int32 hotspotX = 0, int32 hotspotY = 0);
TransformStruct(int32 numTimesX, int32 numTimesY);
TransformStruct();
Common::Point _zoom; ///< Zoom; 100 = no zoom
Common::Point _hotspot; ///< Position of the hotspot
int32 _angle; ///< Rotation angle, in degrees
byte _flip; ///< Bitflag: see TransparentSurface::FLIP_XXX
bool _alphaDisable;
TSpriteBlendMode _blendMode;
uint32 _rgbaMod; ///< RGBa
Common::Point _offset;
int32 _numTimesX;
int32 _numTimesY;
bool getMirrorX() const;
bool getMirrorY() const;
bool operator==(const TransformStruct &compare) const {
return (compare._angle == _angle &&
compare._flip == _flip &&
compare._zoom == _zoom &&
compare._offset == _offset &&
compare._alphaDisable == _alphaDisable &&
compare._rgbaMod == _rgbaMod &&
compare._blendMode == _blendMode &&
compare._numTimesX == _numTimesX &&
compare._numTimesY == _numTimesY
);
}
bool operator!=(const TransformStruct &compare) const {
return !(compare == *this);
}
};
} // End of namespace Graphics
#endif

View file

@ -0,0 +1,87 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include "graphics/transform_tools.h"
#include <math.h>
namespace Graphics {
FloatPoint TransformTools::transformPoint(FloatPoint point, const float rotate, const Common::Point &zoom, const bool mirrorX, const bool mirrorY) {
float rotateRad = rotate * M_PI / 180.0f;
float x = point.x;
float y = point.y;
x = (x * zoom.x) / kDefaultZoomX;
y = (y * zoom.y) / kDefaultZoomY;
#if 0
// TODO: Mirroring should be done before rotation, but the blitting
// code does the inverse, so we match that for now.
if (mirrorX)
x *= -1;
if (mirrorY)
y *= -1;
#endif
FloatPoint newPoint;
newPoint.x = x * cos(rotateRad) - y * sin(rotateRad);
newPoint.y = x * sin(rotateRad) + y * cos(rotateRad);
if (mirrorX) {
newPoint.x *= -1;
}
if (mirrorY) {
newPoint.y *= -1;
}
return newPoint;
}
Common::Rect TransformTools::newRect(const Common::Rect &oldRect, const TransformStruct &transform, Common::Point *newHotspot) {
Common::Point nw(oldRect.left, oldRect.top);
Common::Point ne(oldRect.right, oldRect.top);
Common::Point sw(oldRect.left, oldRect.bottom);
Common::Point se(oldRect.right, oldRect.bottom);
FloatPoint nw1, ne1, sw1, se1;
nw1 = transformPoint(nw - transform._hotspot, transform._angle, transform._zoom);
ne1 = transformPoint(ne - transform._hotspot, transform._angle, transform._zoom);
sw1 = transformPoint(sw - transform._hotspot, transform._angle, transform._zoom);
se1 = transformPoint(se - transform._hotspot, transform._angle, transform._zoom);
float top = MIN(nw1.y, MIN(ne1.y, MIN(sw1.y, se1.y)));
float bottom = MAX(nw1.y, MAX(ne1.y, MAX(sw1.y, se1.y)));
float left = MIN(nw1.x, MIN(ne1.x, MIN(sw1.x, se1.x)));
float right = MAX(nw1.x, MAX(ne1.x, MAX(sw1.x, se1.x)));
if (newHotspot) {
newHotspot->y = (uint32)(-floor(top));
newHotspot->x = (uint32)(-floor(left));
}
Common::Rect res;
res.top = (int32)(floor(top)) + transform._hotspot.y;
res.bottom = (int32)(ceil(bottom)) + transform._hotspot.y;
res.left = (int32)(floor(left)) + transform._hotspot.x;
res.right = (int32)(ceil(right)) + transform._hotspot.x;
return res;
}
} // End of namespace Graphics

View file

@ -0,0 +1,77 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef GRAPHICS_TRANSFORM_TOOLS_H
#define GRAPHICS_TRANSFORM_TOOLS_H
#include "common/rect.h"
#include "graphics/transform_struct.h"
namespace Graphics {
static const float kEpsilon = 0.00001; // arbitrarily taken number
struct FloatPoint {
float x;
float y;
FloatPoint() : x(0), y(0) {}
FloatPoint(float x1, float y1) : x(x1), y(y1) {}
FloatPoint(const Common::Point p) : x(p.x), y(p.y) {}
bool operator==(const FloatPoint &p) const { return fabs(x - p.x) < kEpsilon && fabs(y - p.y) < kEpsilon; }
bool operator!=(const FloatPoint &p) const { return fabs(x - p.x) > kEpsilon || fabs(y - p.y) > kEpsilon; }
FloatPoint operator+(const FloatPoint &delta) const { return FloatPoint (x + delta.x, y + delta.y); }
FloatPoint operator-(const FloatPoint &delta) const { return FloatPoint (x - delta.x, y - delta.y); }
FloatPoint& operator+=(const FloatPoint &delta) {
x += delta.x;
y += delta.y;
return *this;
}
FloatPoint& operator-=(const FloatPoint &delta) {
x -= delta.x;
y -= delta.y;
return *this;
}
};
class TransformTools {
public:
/**
* Basic transform (scale + rotate) for a single point
*/
static FloatPoint transformPoint(FloatPoint point, const float rotate, const Common::Point &zoom, const bool mirrorX = false, const bool mirrorY = false);
/**
* @param &point the point on which the transform is to be applied
* @param rotate the angle in degrees
* @param &zoom zoom x,y in percent
* @param mirrorX flip along the vertical axis?
* @param mirrorY flip along the horizontal axis?
* @return the smallest rect that can contain the transformed sprite
* and, as a side-effect, "newHotspot" will tell you where the hotspot will
* have ended up in the new rect, for centering.
*/
static Common::Rect newRect(const Common::Rect &oldRect, const TransformStruct &transform, Common::Point *newHotspot);
};
} // End of namespace Wintermute
#endif

View file

@ -0,0 +1,851 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*
* The bottom part of this is file is adapted from SDL_rotozoom.c. The
* relevant copyright notice for those specific functions can be found at the
* top of that section.
*
*/
#include "common/algorithm.h"
#include "common/endian.h"
#include "common/util.h"
#include "common/rect.h"
#include "common/math.h"
#include "common/textconsole.h"
#include "graphics/primitives.h"
#include "graphics/transparent_surface.h"
#include "graphics/transform_tools.h"
//#define ENABLE_BILINEAR
namespace Graphics {
static const int kAShift = 0;//img->format.aShift;
static const int kBModShift = 0;//img->format.bShift;
static const int kGModShift = 8;//img->format.gShift;
static const int kRModShift = 16;//img->format.rShift;
static const int kAModShift = 24;//img->format.aShift;
#ifdef SCUMM_LITTLE_ENDIAN
static const int kAIndex = 0;
static const int kBIndex = 1;
static const int kGIndex = 2;
static const int kRIndex = 3;
#else
static const int kAIndex = 3;
static const int kBIndex = 2;
static const int kGIndex = 1;
static const int kRIndex = 0;
#endif
void doBlitOpaqueFast(byte *ino, byte *outo, uint32 width, uint32 height, uint32 pitch, int32 inStep, int32 inoStep);
void doBlitBinaryFast(byte *ino, byte *outo, uint32 width, uint32 height, uint32 pitch, int32 inStep, int32 inoStep);
void doBlitAlphaBlend(byte *ino, byte *outo, uint32 width, uint32 height, uint32 pitch, int32 inStep, int32 inoStep, uint32 color);
void doBlitAdditiveBlend(byte *ino, byte *outo, uint32 width, uint32 height, uint32 pitch, int32 inStep, int32 inoStep, uint32 color);
void doBlitSubtractiveBlend(byte *ino, byte *outo, uint32 width, uint32 height, uint32 pitch, int32 inStep, int32 inoStep, uint32 color);
TransparentSurface::TransparentSurface() : Surface(), _alphaMode(ALPHA_FULL) {}
TransparentSurface::TransparentSurface(const Surface &surf, bool copyData) : Surface(), _alphaMode(ALPHA_FULL) {
if (copyData) {
copyFrom(surf);
} else {
w = surf.w;
h = surf.h;
pitch = surf.pitch;
format = surf.format;
// We need to cast the const qualifier away here because 'pixels'
// always needs to be writable. 'surf' however is a constant Surface,
// thus getPixels will always return const pixel data.
pixels = const_cast<void *>(surf.getPixels());
}
}
/**
* Optimized version of doBlit to be used w/opaque blitting (no alpha).
*/
void doBlitOpaqueFast(byte *ino, byte *outo, uint32 width, uint32 height, uint32 pitch, int32 inStep, int32 inoStep) {
byte *in;
byte *out;
for (uint32 i = 0; i < height; i++) {
out = outo;
in = ino;
memcpy(out, in, width * 4);
for (uint32 j = 0; j < width; j++) {
out[kAIndex] = 0xFF;
out += 4;
}
outo += pitch;
ino += inoStep;
}
}
/**
* Optimized version of doBlit to be used w/binary blitting (blit or no-blit, no blending).
*/
void doBlitBinaryFast(byte *ino, byte *outo, uint32 width, uint32 height, uint32 pitch, int32 inStep, int32 inoStep) {
byte *in;
byte *out;
for (uint32 i = 0; i < height; i++) {
out = outo;
in = ino;
for (uint32 j = 0; j < width; j++) {
uint32 pix = *(uint32 *)in;
int a = (pix >> kAShift) & 0xff;
if (a != 0) { // Full opacity (Any value not exactly 0 is Opaque here)
*(uint32 *)out = pix;
out[kAIndex] = 0xFF;
}
out += 4;
in += inStep;
}
outo += pitch;
ino += inoStep;
}
}
/**
* Optimized version of doBlit to be used with alpha blended blitting
* @param ino a pointer to the input surface
* @param outo a pointer to the output surface
* @param width width of the input surface
* @param height height of the input surface
* @param pitch pitch of the output surface - that is, width in bytes of every row, usually bpp * width of the TARGET surface (the area we are blitting to might be smaller, do the math)
* @inStep size in bytes to skip to address each pixel, usually bpp of the source surface
* @inoStep width in bytes of every row on the *input* surface / kind of like pitch
* @color colormod in 0xAARRGGBB format - 0xFFFFFFFF for no colormod
*/
void doBlitAlphaBlend(byte *ino, byte *outo, uint32 width, uint32 height, uint32 pitch, int32 inStep, int32 inoStep, uint32 color) {
byte *in;
byte *out;
if (color == 0xffffffff) {
for (uint32 i = 0; i < height; i++) {
out = outo;
in = ino;
for (uint32 j = 0; j < width; j++) {
if (in[kAIndex] != 0) {
out[kAIndex] = 255;
out[kRIndex] = ((in[kRIndex] * in[kAIndex]) + out[kRIndex] * (255 - in[kAIndex])) >> 8;
out[kGIndex] = ((in[kGIndex] * in[kAIndex]) + out[kGIndex] * (255 - in[kAIndex])) >> 8;
out[kBIndex] = ((in[kBIndex] * in[kAIndex]) + out[kBIndex] * (255 - in[kAIndex])) >> 8;
}
in += inStep;
out += 4;
}
outo += pitch;
ino += inoStep;
}
} else {
byte ca = (color >> kAModShift) & 0xFF;
byte cr = (color >> kRModShift) & 0xFF;
byte cg = (color >> kGModShift) & 0xFF;
byte cb = (color >> kBModShift) & 0xFF;
for (uint32 i = 0; i < height; i++) {
out = outo;
in = ino;
for (uint32 j = 0; j < width; j++) {
uint32 ina = in[kAIndex] * ca >> 8;
out[kAIndex] = 255;
out[kBIndex] = (out[kBIndex] * (255 - ina) >> 8);
out[kGIndex] = (out[kGIndex] * (255 - ina) >> 8);
out[kRIndex] = (out[kRIndex] * (255 - ina) >> 8);
out[kBIndex] = out[kBIndex] + (in[kBIndex] * ina * cb >> 16);
out[kGIndex] = out[kGIndex] + (in[kGIndex] * ina * cg >> 16);
out[kRIndex] = out[kRIndex] + (in[kRIndex] * ina * cr >> 16);
in += inStep;
out += 4;
}
outo += pitch;
ino += inoStep;
}
}
}
/**
* Optimized version of doBlit to be used with additive blended blitting
*/
void doBlitAdditiveBlend(byte *ino, byte *outo, uint32 width, uint32 height, uint32 pitch, int32 inStep, int32 inoStep, uint32 color) {
byte *in;
byte *out;
if (color == 0xffffffff) {
for (uint32 i = 0; i < height; i++) {
out = outo;
in = ino;
for (uint32 j = 0; j < width; j++) {
if (in[kAIndex] != 0) {
out[kRIndex] = MIN((in[kRIndex] * in[kAIndex] >> 8) + out[kRIndex], 255);
out[kGIndex] = MIN((in[kGIndex] * in[kAIndex] >> 8) + out[kGIndex], 255);
out[kBIndex] = MIN((in[kBIndex] * in[kAIndex] >> 8) + out[kBIndex], 255);
}
in += inStep;
out += 4;
}
outo += pitch;
ino += inoStep;
}
} else {
byte ca = (color >> kAModShift) & 0xFF;
byte cr = (color >> kRModShift) & 0xFF;
byte cg = (color >> kGModShift) & 0xFF;
byte cb = (color >> kBModShift) & 0xFF;
for (uint32 i = 0; i < height; i++) {
out = outo;
in = ino;
for (uint32 j = 0; j < width; j++) {
uint32 ina = in[kAIndex] * ca >> 8;
if (cb != 255) {
out[kBIndex] = MIN<uint>(out[kBIndex] + ((in[kBIndex] * cb * ina) >> 16), 255u);
} else {
out[kBIndex] = MIN<uint>(out[kBIndex] + (in[kBIndex] * ina >> 8), 255u);
}
if (cg != 255) {
out[kGIndex] = MIN<uint>(out[kGIndex] + ((in[kGIndex] * cg * ina) >> 16), 255u);
} else {
out[kGIndex] = MIN<uint>(out[kGIndex] + (in[kGIndex] * ina >> 8), 255u);
}
if (cr != 255) {
out[kRIndex] = MIN<uint>(out[kRIndex] + ((in[kRIndex] * cr * ina) >> 16), 255u);
} else {
out[kRIndex] = MIN<uint>(out[kRIndex] + (in[kRIndex] * ina >> 8), 255u);
}
in += inStep;
out += 4;
}
outo += pitch;
ino += inoStep;
}
}
}
/**
* Optimized version of doBlit to be used with subtractive blended blitting
*/
void doBlitSubtractiveBlend(byte *ino, byte *outo, uint32 width, uint32 height, uint32 pitch, int32 inStep, int32 inoStep, uint32 color) {
byte *in;
byte *out;
if (color == 0xffffffff) {
for (uint32 i = 0; i < height; i++) {
out = outo;
in = ino;
for (uint32 j = 0; j < width; j++) {
if (in[kAIndex] != 0) {
out[kRIndex] = MAX(out[kRIndex] - ((in[kRIndex] * out[kRIndex]) * in[kAIndex] >> 16), 0);
out[kGIndex] = MAX(out[kGIndex] - ((in[kGIndex] * out[kGIndex]) * in[kAIndex] >> 16), 0);
out[kBIndex] = MAX(out[kBIndex] - ((in[kBIndex] * out[kBIndex]) * in[kAIndex] >> 16), 0);
}
in += inStep;
out += 4;
}
outo += pitch;
ino += inoStep;
}
} else {
byte cr = (color >> kRModShift) & 0xFF;
byte cg = (color >> kGModShift) & 0xFF;
byte cb = (color >> kBModShift) & 0xFF;
for (uint32 i = 0; i < height; i++) {
out = outo;
in = ino;
for (uint32 j = 0; j < width; j++) {
out[kAIndex] = 255;
if (cb != 255) {
out[kBIndex] = MAX(out[kBIndex] - ((in[kBIndex] * cb * (out[kBIndex]) * in[kAIndex]) >> 24), 0);
} else {
out[kBIndex] = MAX(out[kBIndex] - (in[kBIndex] * (out[kBIndex]) * in[kAIndex] >> 16), 0);
}
if (cg != 255) {
out[kGIndex] = MAX(out[kGIndex] - ((in[kGIndex] * cg * (out[kGIndex]) * in[kAIndex]) >> 24), 0);
} else {
out[kGIndex] = MAX(out[kGIndex] - (in[kGIndex] * (out[kGIndex]) * in[kAIndex] >> 16), 0);
}
if (cr != 255) {
out[kRIndex] = MAX(out[kRIndex] - ((in[kRIndex] * cr * (out[kRIndex]) * in[kAIndex]) >> 24), 0);
} else {
out[kRIndex] = MAX(out[kRIndex] - (in[kRIndex] * (out[kRIndex]) * in[kAIndex] >> 16), 0);
}
in += inStep;
out += 4;
}
outo += pitch;
ino += inoStep;
}
}
}
Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int posY, int flipping, Common::Rect *pPartRect, uint color, int width, int height, TSpriteBlendMode blendMode) {
Common::Rect retSize;
retSize.top = 0;
retSize.left = 0;
retSize.setWidth(0);
retSize.setHeight(0);
// Check if we need to draw anything at all
int ca = (color >> 24) & 0xff;
if (ca == 0) {
return retSize;
}
// Create an encapsulating surface for the data
TransparentSurface srcImage(*this, false);
// TODO: Is the data really in the screen format?
if (format.bytesPerPixel != 4) {
warning("TransparentSurface can only blit 32bpp images, but got %d", format.bytesPerPixel * 8);
return retSize;
}
if (pPartRect) {
int xOffset = pPartRect->left;
int yOffset = pPartRect->top;
if (flipping & FLIP_V) {
yOffset = srcImage.h - pPartRect->bottom;
}
if (flipping & FLIP_H) {
xOffset = srcImage.w - pPartRect->right;
}
srcImage.pixels = getBasePtr(xOffset, yOffset);
srcImage.w = pPartRect->width();
srcImage.h = pPartRect->height();
debug(6, "Blit(%d, %d, %d, [%d, %d, %d, %d], %08x, %d, %d)", posX, posY, flipping,
pPartRect->left, pPartRect->top, pPartRect->width(), pPartRect->height(), color, width, height);
} else {
debug(6, "Blit(%d, %d, %d, [%d, %d, %d, %d], %08x, %d, %d)", posX, posY, flipping, 0, 0,
srcImage.w, srcImage.h, color, width, height);
}
if (width == -1) {
width = srcImage.w;
}
if (height == -1) {
height = srcImage.h;
}
#ifdef SCALING_TESTING
// Hardcode scaling to 66% to test scaling
width = width * 2 / 3;
height = height * 2 / 3;
#endif
Graphics::Surface *img = nullptr;
Graphics::Surface *imgScaled = nullptr;
byte *savedPixels = nullptr;
if ((width != srcImage.w) || (height != srcImage.h)) {
// Scale the image
img = imgScaled = srcImage.scale(width, height);
savedPixels = (byte *)img->getPixels();
} else {
img = &srcImage;
}
// Handle off-screen clipping
if (posY < 0) {
img->h = MAX(0, (int)img->h - -posY);
img->setPixels((byte *)img->getBasePtr(0, -posY));
posY = 0;
}
if (posX < 0) {
img->w = MAX(0, (int)img->w - -posX);
img->setPixels((byte *)img->getBasePtr(-posX, 0));
posX = 0;
}
img->w = CLIP((int)img->w, 0, (int)MAX((int)target.w - posX, 0));
img->h = CLIP((int)img->h, 0, (int)MAX((int)target.h - posY, 0));
if ((img->w > 0) && (img->h > 0)) {
int xp = 0, yp = 0;
int inStep = 4;
int inoStep = img->pitch;
if (flipping & FLIP_H) {
inStep = -inStep;
xp = img->w - 1;
}
if (flipping & FLIP_V) {
inoStep = -inoStep;
yp = img->h - 1;
}
byte *ino = (byte *)img->getBasePtr(xp, yp);
byte *outo = (byte *)target.getBasePtr(posX, posY);
if (color == 0xFFFFFFFF && blendMode == BLEND_NORMAL && _alphaMode == ALPHA_OPAQUE) {
doBlitOpaqueFast(ino, outo, img->w, img->h, target.pitch, inStep, inoStep);
} else if (color == 0xFFFFFFFF && blendMode == BLEND_NORMAL && _alphaMode == ALPHA_BINARY) {
doBlitBinaryFast(ino, outo, img->w, img->h, target.pitch, inStep, inoStep);
} else {
if (blendMode == BLEND_ADDITIVE) {
doBlitAdditiveBlend(ino, outo, img->w, img->h, target.pitch, inStep, inoStep, color);
} else if (blendMode == BLEND_SUBTRACTIVE) {
doBlitSubtractiveBlend(ino, outo, img->w, img->h, target.pitch, inStep, inoStep, color);
} else {
assert(blendMode == BLEND_NORMAL);
doBlitAlphaBlend(ino, outo, img->w, img->h, target.pitch, inStep, inoStep, color);
}
}
}
retSize.setWidth(img->w);
retSize.setHeight(img->h);
if (imgScaled) {
imgScaled->setPixels(savedPixels);
imgScaled->free();
delete imgScaled;
}
return retSize;
}
/**
* Writes a color key to the alpha channel of the surface
* @param rKey the red component of the color key
* @param gKey the green component of the color key
* @param bKey the blue component of the color key
* @param overwriteAlpha if true, all other alpha will be set fully opaque
*/
void TransparentSurface::applyColorKey(uint8 rKey, uint8 gKey, uint8 bKey, bool overwriteAlpha) {
assert(format.bytesPerPixel == 4);
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
uint32 pix = ((uint32 *)pixels)[i * w + j];
uint8 r, g, b, a;
format.colorToARGB(pix, a, r, g, b);
if (r == rKey && g == gKey && b == bKey) {
a = 0;
((uint32 *)pixels)[i * w + j] = format.ARGBToColor(a, r, g, b);
} else if (overwriteAlpha) {
a = 255;
((uint32 *)pixels)[i * w + j] = format.ARGBToColor(a, r, g, b);
}
}
}
}
AlphaType TransparentSurface::getAlphaMode() const {
return _alphaMode;
}
void TransparentSurface::setAlphaMode(AlphaType mode) {
_alphaMode = mode;
}
/*
The below two functions are adapted from SDL_rotozoom.c,
taken from SDL_gfx-2.0.18.
Its copyright notice:
=============================================================================
SDL_rotozoom.c: rotozoomer, zoomer and shrinker for 32bit or 8bit surfaces
Copyright (C) 2001-2012 Andreas Schiffler
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
Andreas Schiffler -- aschiffler at ferzkopp dot net
=============================================================================
The functions have been adapted for different structures and coordinate
systems.
*/
TransparentSurface *TransparentSurface::rotoscale(const TransformStruct &transform) const {
assert(transform._angle != 0); // This would not be ideal; rotoscale() should never be called in conditional branches where angle = 0 anyway.
Common::Point newHotspot;
Common::Rect srcRect(0, 0, (int16)w, (int16)h);
Common::Rect rect = TransformTools::newRect(Common::Rect(srcRect), transform, &newHotspot);
Common::Rect dstRect(0, 0, (int16)(rect.right - rect.left), (int16)(rect.bottom - rect.top));
TransparentSurface *target = new TransparentSurface();
assert(format.bytesPerPixel == 4);
int srcW = w;
int srcH = h;
int dstW = dstRect.width();
int dstH = dstRect.height();
target->create((uint16)dstW, (uint16)dstH, this->format);
if (transform._zoom.x == 0 || transform._zoom.y == 0) {
return target;
}
uint32 invAngle = 360 - (transform._angle % 360);
float invCos = cos(invAngle * M_PI / 180.0);
float invSin = sin(invAngle * M_PI / 180.0);
struct tColorRGBA { byte r; byte g; byte b; byte a; };
int icosx = (int)(invCos * (65536.0f * kDefaultZoomX / transform._zoom.x));
int isinx = (int)(invSin * (65536.0f * kDefaultZoomX / transform._zoom.x));
int icosy = (int)(invCos * (65536.0f * kDefaultZoomY / transform._zoom.y));
int isiny = (int)(invSin * (65536.0f * kDefaultZoomY / transform._zoom.y));
bool flipx = false, flipy = false; // TODO: See mirroring comment in RenderTicket ctor
int xd = (srcRect.left + transform._hotspot.x) << 16;
int yd = (srcRect.top + transform._hotspot.y) << 16;
int cx = newHotspot.x;
int cy = newHotspot.y;
int ax = -icosx * cx;
int ay = -isiny * cx;
int sw = srcW - 1;
int sh = srcH - 1;
tColorRGBA *pc = (tColorRGBA*)target->getBasePtr(0, 0);
for (int y = 0; y < dstH; y++) {
int t = cy - y;
int sdx = ax + (isinx * t) + xd;
int sdy = ay - (icosy * t) + yd;
for (int x = 0; x < dstW; x++) {
int dx = (sdx >> 16);
int dy = (sdy >> 16);
if (flipx) {
dx = sw - dx;
}
if (flipy) {
dy = sh - dy;
}
#ifdef ENABLE_BILINEAR
if ((dx > -1) && (dy > -1) && (dx < sw) && (dy < sh)) {
const tColorRGBA *sp = (const tColorRGBA *)getBasePtr(dx, dy);
tColorRGBA c00, c01, c10, c11, cswap;
c00 = *sp;
sp += 1;
c01 = *sp;
sp += (this->pitch / 4);
c11 = *sp;
sp -= 1;
c10 = *sp;
if (flipx) {
cswap = c00; c00=c01; c01=cswap;
cswap = c10; c10=c11; c11=cswap;
}
if (flipy) {
cswap = c00; c00=c10; c10=cswap;
cswap = c01; c01=c11; c11=cswap;
}
/*
* Interpolate colors
*/
int ex = (sdx & 0xffff);
int ey = (sdy & 0xffff);
int t1, t2;
t1 = ((((c01.r - c00.r) * ex) >> 16) + c00.r) & 0xff;
t2 = ((((c11.r - c10.r) * ex) >> 16) + c10.r) & 0xff;
pc->r = (((t2 - t1) * ey) >> 16) + t1;
t1 = ((((c01.g - c00.g) * ex) >> 16) + c00.g) & 0xff;
t2 = ((((c11.g - c10.g) * ex) >> 16) + c10.g) & 0xff;
pc->g = (((t2 - t1) * ey) >> 16) + t1;
t1 = ((((c01.b - c00.b) * ex) >> 16) + c00.b) & 0xff;
t2 = ((((c11.b - c10.b) * ex) >> 16) + c10.b) & 0xff;
pc->b = (((t2 - t1) * ey) >> 16) + t1;
t1 = ((((c01.a - c00.a) * ex) >> 16) + c00.a) & 0xff;
t2 = ((((c11.a - c10.a) * ex) >> 16) + c10.a) & 0xff;
pc->a = (((t2 - t1) * ey) >> 16) + t1;
}
#else
if ((dx >= 0) && (dy >= 0) && (dx < srcW) && (dy < srcH)) {
const tColorRGBA *sp = (const tColorRGBA *)getBasePtr(dx, dy);
*pc = *sp;
}
#endif
sdx += icosx;
sdy += isiny;
pc++;
}
}
return target;
}
TransparentSurface *TransparentSurface::scale(uint16 newWidth, uint16 newHeight) const {
Common::Rect srcRect(0, 0, (int16)w, (int16)h);
Common::Rect dstRect(0, 0, (int16)newWidth, (int16)newHeight);
TransparentSurface *target = new TransparentSurface();
assert(format.bytesPerPixel == 4);
int srcW = srcRect.width();
int srcH = srcRect.height();
int dstW = dstRect.width();
int dstH = dstRect.height();
target->create((uint16)dstW, (uint16)dstH, this->format);
#ifdef ENABLE_BILINEAR
// NB: The actual order of these bytes may not be correct, but
// since all values are treated equal, that does not matter.
struct tColorRGBA { byte r; byte g; byte b; byte a; };
bool flipx = false, flipy = false; // TODO: See mirroring comment in RenderTicket ctor
int *sax = new int[dstW + 1];
int *say = new int[dstH + 1];
assert(sax && say);
/*
* Precalculate row increments
*/
int spixelw = (srcW - 1);
int spixelh = (srcH - 1);
int sx = (int) (65536.0f * (float) spixelw / (float) (dstW - 1));
int sy = (int) (65536.0f * (float) spixelh / (float) (dstH - 1));
/* Maximum scaled source size */
int ssx = (srcW << 16) - 1;
int ssy = (srcH << 16) - 1;
/* Precalculate horizontal row increments */
int csx = 0;
int *csax = sax;
for (int x = 0; x <= dstW; x++) {
*csax = csx;
csax++;
csx += sx;
/* Guard from overflows */
if (csx > ssx) {
csx = ssx;
}
}
/* Precalculate vertical row increments */
int csy = 0;
int *csay = say;
for (int y = 0; y <= dstH; y++) {
*csay = csy;
csay++;
csy += sy;
/* Guard from overflows */
if (csy > ssy) {
csy = ssy;
}
}
const tColorRGBA *sp = (const tColorRGBA *) getBasePtr(0, 0);
tColorRGBA *dp = (tColorRGBA *) target->getBasePtr(0, 0);
int spixelgap = srcW;
if (flipx) {
sp += spixelw;
}
if (flipy) {
sp += spixelgap * spixelh;
}
csay = say;
for (int y = 0; y < dstH; y++) {
const tColorRGBA *csp = sp;
csax = sax;
for (int x = 0; x < dstW; x++) {
/*
* Setup color source pointers
*/
int ex = (*csax & 0xffff);
int ey = (*csay & 0xffff);
int cx = (*csax >> 16);
int cy = (*csay >> 16);
const tColorRGBA *c00, *c01, *c10, *c11;
c00 = sp;
c01 = sp;
c10 = sp;
if (cy < spixelh) {
if (flipy) {
c10 -= spixelgap;
} else {
c10 += spixelgap;
}
}
c11 = c10;
if (cx < spixelw) {
if (flipx) {
c01--;
c11--;
} else {
c01++;
c11++;
}
}
/*
* Draw and interpolate colors
*/
int t1, t2;
t1 = ((((c01->r - c00->r) * ex) >> 16) + c00->r) & 0xff;
t2 = ((((c11->r - c10->r) * ex) >> 16) + c10->r) & 0xff;
dp->r = (((t2 - t1) * ey) >> 16) + t1;
t1 = ((((c01->g - c00->g) * ex) >> 16) + c00->g) & 0xff;
t2 = ((((c11->g - c10->g) * ex) >> 16) + c10->g) & 0xff;
dp->g = (((t2 - t1) * ey) >> 16) + t1;
t1 = ((((c01->b - c00->b) * ex) >> 16) + c00->b) & 0xff;
t2 = ((((c11->b - c10->b) * ex) >> 16) + c10->b) & 0xff;
dp->b = (((t2 - t1) * ey) >> 16) + t1;
t1 = ((((c01->a - c00->a) * ex) >> 16) + c00->a) & 0xff;
t2 = ((((c11->a - c10->a) * ex) >> 16) + c10->a) & 0xff;
dp->a = (((t2 - t1) * ey) >> 16) + t1;
/*
* Advance source pointer x
*/
int *salastx = csax;
csax++;
int sstepx = (*csax >> 16) - (*salastx >> 16);
if (flipx) {
sp -= sstepx;
} else {
sp += sstepx;
}
/*
* Advance destination pointer x
*/
dp++;
}
/*
* Advance source pointer y
*/
int *salasty = csay;
csay++;
int sstepy = (*csay >> 16) - (*salasty >> 16);
sstepy *= spixelgap;
if (flipy) {
sp = csp - sstepy;
} else {
sp = csp + sstepy;
}
}
delete[] sax;
delete[] say;
#else
int *scaleCacheX = new int[dstW];
for (int x = 0; x < dstW; x++) {
scaleCacheX[x] = (x * srcW) / dstW;
}
for (int y = 0; y < dstH; y++) {
uint32 *destP = (uint32 *)target->getBasePtr(0, y);
const uint32 *srcP = (const uint32 *)getBasePtr(0, (y * srcH) / dstH);
for (int x = 0; x < dstW; x++) {
*destP++ = srcP[scaleCacheX[x]];
}
}
delete[] scaleCacheX;
#endif
return target;
}
} // End of namespace Graphics

View file

@ -0,0 +1,156 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef GRAPHICS_TRANSPARENTSURFACE_H
#define GRAPHICS_TRANSPARENTSURFACE_H
#include "graphics/surface.h"
#include "graphics/transform_struct.h"
/*
* This code is based on Broken Sword 2.5 engine
*
* Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdoerfer
*
* Licensed under GNU GPL v2
*
*/
#ifdef SCUMM_LITTLE_ENDIAN
#define TS_RGB(R,G,B) ((0xff << 24) | ((R) << 16) | ((G) << 8) | (B))
#define TS_ARGB(A,R,G,B) (((R) << 24) | ((G) << 16) | ((B) << 8) | (A))
#else
#define TS_RGB(R,G,B) (((R) << 24) | ((G) << 16) | (B << 8) | 0xff)
#define TS_ARGB(A,R,G,B) (((R) << 24) | ((G) << 16) | ((B) << 8) | (A))
#endif
namespace Graphics {
// Enums
/**
@brief The possible flipping parameters for the blit method.
*/
enum FLIP_FLAGS {
/// The image will not be flipped.
FLIP_NONE = 0,
/// The image will be flipped at the horizontal axis.
FLIP_H = 1,
/// The image will be flipped at the vertical axis.
FLIP_V = 2,
/// The image will be flipped at the horizontal and vertical axis.
FLIP_HV = FLIP_H | FLIP_V,
/// The image will be flipped at the horizontal and vertical axis.
FLIP_VH = FLIP_H | FLIP_V
};
enum AlphaType {
ALPHA_OPAQUE = 0,
ALPHA_BINARY = 1,
ALPHA_FULL = 2
};
/**
* A transparent graphics surface, which implements alpha blitting.
*/
struct TransparentSurface : public Graphics::Surface {
TransparentSurface();
TransparentSurface(const Graphics::Surface &surf, bool copyData = false);
void setColorKey(char r, char g, char b);
void disableColorKey();
/**
@brief renders the surface to another surface
@param target a pointer to the target surface. In most cases this is the framebuffer.
@param posX the position on the X-axis in the target image in pixels where the image is supposed to be rendered.<br>
The default value is 0.
@param posY the position on the Y-axis in the target image in pixels where the image is supposed to be rendered.<br>
The default value is 0.
@param flipping how the the image should be flipped.<br>
The default value is Graphics::FLIP_NONE (no flipping)
@param pPartRect Pointer on Common::Rect which specifies the section to be rendered. If the whole image has to be rendered the Pointer is NULL.<br>
This referes to the unflipped and unscaled image.<br>
The default value is NULL.
@param color an ARGB color value, which determines the parameters for the color modulation und alpha blending.<br>
The alpha component of the color determines the alpha blending parameter (0 = no covering, 255 = full covering).<br>
The color components determines the color for color modulation.<br>
The default value is TS_ARGB(255, 255, 255, 255) (full covering, no color modulation).
The macros TS_RGB and TS_ARGB can be used for the creation of the color value.
@param width the output width of the screen section.
The images will be scaled if the output width of the screen section differs from the image section.<br>
The value -1 determines that the image should not be scaled.<br>
The default value is -1.
@param height the output height of the screen section.
The images will be scaled if the output width of the screen section differs from the image section.<br>
The value -1 determines that the image should not be scaled.<br>
The default value is -1.
@return returns false if the rendering failed.
*/
Common::Rect blit(Graphics::Surface &target, int posX = 0, int posY = 0,
int flipping = FLIP_NONE,
Common::Rect *pPartRect = nullptr,
uint color = TS_ARGB(255, 255, 255, 255),
int width = -1, int height = -1,
TSpriteBlendMode blend = BLEND_NORMAL);
void applyColorKey(uint8 r, uint8 g, uint8 b, bool overwriteAlpha = false);
/**
* @brief Scale function; this returns a transformed version of this surface after rotation and
* scaling. Please do not use this if angle != 0, use rotoscale.
*
* @param newWidth the resulting width.
* @param newHeight the resulting height.
* @see TransformStruct
*/
TransparentSurface *scale(uint16 newWidth, uint16 newHeight) const;
/**
* @brief Rotoscale function; this returns a transformed version of this surface after rotation and
* scaling. Please do not use this if angle == 0, use plain old scaling function.
*
* @param transform a TransformStruct wrapping the required info. @see TransformStruct
*
*/
TransparentSurface *rotoscale(const TransformStruct &transform) const;
AlphaType getAlphaMode() const;
void setAlphaMode(AlphaType);
private:
AlphaType _alphaMode;
};
/**
* A deleter for Surface objects which can be used with SharedPtr.
*
* This deleter assures Surface::free is called on deletion.
*/
/*struct SharedPtrTransparentSurfaceDeleter {
void operator()(TransparentSurface *ptr) {
ptr->free();
delete ptr;
}
};*/
} // End of namespace Graphics
#endif

View file

@ -1446,7 +1446,7 @@ const Graphics::Font *ThemeEngine::loadScalableFont(const Common::String &filena
for (Common::ArchiveMemberList::const_iterator i = members.begin(), end = members.end(); i != end; ++i) {
Common::SeekableReadStream *stream = (*i)->createReadStream();
if (stream) {
font = Graphics::loadTTFFont(*stream, pointsize, 0, false,
font = Graphics::loadTTFFont(*stream, pointsize, 0, Graphics::kTTFRenderModeLight,
#ifdef USE_TRANSLATION
TransMan.getCharsetMapping()
#else

View file

@ -23,6 +23,7 @@
// NB: This is really only necessary if USE_READLINE is defined
#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "common/debug.h"
#include "common/debug-channels.h"
#include "common/system.h"
@ -51,20 +52,20 @@ Debugger::Debugger() {
#endif
// Register variables
DVar_Register("debug_countdown", &_frameCountdown, DVAR_INT, 0);
registerVar("debug_countdown", &_frameCountdown, DVAR_INT, 0);
// Register commands
//DCmd_Register("continue", WRAP_METHOD(Debugger, Cmd_Exit));
DCmd_Register("exit", WRAP_METHOD(Debugger, Cmd_Exit));
DCmd_Register("quit", WRAP_METHOD(Debugger, Cmd_Exit));
//registerCmd("continue", WRAP_METHOD(Debugger, cmdExit));
registerCmd("exit", WRAP_METHOD(Debugger, cmdExit));
registerCmd("quit", WRAP_METHOD(Debugger, cmdExit));
DCmd_Register("help", WRAP_METHOD(Debugger, Cmd_Help));
DCmd_Register("openlog", WRAP_METHOD(Debugger, Cmd_OpenLog));
registerCmd("help", WRAP_METHOD(Debugger, cmdHelp));
registerCmd("openlog", WRAP_METHOD(Debugger, cmdOpenLog));
DCmd_Register("debuglevel", WRAP_METHOD(Debugger, Cmd_DebugLevel));
DCmd_Register("debugflag_list", WRAP_METHOD(Debugger, Cmd_DebugFlagsList));
DCmd_Register("debugflag_enable", WRAP_METHOD(Debugger, Cmd_DebugFlagEnable));
DCmd_Register("debugflag_disable", WRAP_METHOD(Debugger, Cmd_DebugFlagDisable));
registerCmd("debuglevel", WRAP_METHOD(Debugger, cmdDebugLevel));
registerCmd("debugflag_list", WRAP_METHOD(Debugger, cmdDebugFlagsList));
registerCmd("debugflag_enable", WRAP_METHOD(Debugger, cmdDebugFlagEnable));
registerCmd("debugflag_disable", WRAP_METHOD(Debugger, cmdDebugFlagDisable));
}
Debugger::~Debugger() {
@ -75,7 +76,7 @@ Debugger::~Debugger() {
// Initialisation Functions
int Debugger::DebugPrintf(const char *format, ...) {
int Debugger::debugPrintf(const char *format, ...) {
va_list argptr;
va_start(argptr, format);
@ -152,13 +153,13 @@ void Debugger::enter() {
#ifndef USE_TEXT_CONSOLE_FOR_DEBUGGER
if (_firstTime) {
DebugPrintf("Debugger started, type 'exit' to return to the game.\n");
DebugPrintf("Type 'help' to see a little list of commands and variables.\n");
debugPrintf("Debugger started, type 'exit' to return to the game.\n");
debugPrintf("Type 'help' to see a little list of commands and variables.\n");
_firstTime = false;
}
if (_errStr) {
DebugPrintf("ERROR: %s\n\n", _errStr);
debugPrintf("ERROR: %s\n\n", _errStr);
free(_errStr);
_errStr = NULL;
}
@ -241,82 +242,82 @@ bool Debugger::parseCommand(const char *inputOrig) {
}
// It's not a command, so things get a little tricky for variables. Do fuzzy matching to ignore things like subscripts.
for (uint i = 0; i < _dvars.size(); i++) {
if (!strncmp(_dvars[i].name.c_str(), param[0], _dvars[i].name.size())) {
for (uint i = 0; i < _vars.size(); i++) {
if (!strncmp(_vars[i].name.c_str(), param[0], _vars[i].name.size())) {
if (num_params > 1) {
// Alright, we need to check the TYPE of the variable to deref and stuff... the array stuff is a bit ugly :)
switch (_dvars[i].type) {
switch (_vars[i].type) {
// Integer
case DVAR_BYTE:
*(byte *)_dvars[i].variable = atoi(param[1]);
DebugPrintf("byte%s = %d\n", param[0], *(byte *)_dvars[i].variable);
*(byte *)_vars[i].variable = atoi(param[1]);
debugPrintf("byte%s = %d\n", param[0], *(byte *)_vars[i].variable);
break;
case DVAR_INT:
*(int32 *)_dvars[i].variable = atoi(param[1]);
DebugPrintf("(int)%s = %d\n", param[0], *(int32 *)_dvars[i].variable);
*(int32 *)_vars[i].variable = atoi(param[1]);
debugPrintf("(int)%s = %d\n", param[0], *(int32 *)_vars[i].variable);
break;
case DVAR_BOOL:
if (Common::parseBool(param[1], *(bool *)_dvars[i].variable))
DebugPrintf("(bool)%s = %s\n", param[0], *(bool *)_dvars[i].variable ? "true" : "false");
if (Common::parseBool(param[1], *(bool *)_vars[i].variable))
debugPrintf("(bool)%s = %s\n", param[0], *(bool *)_vars[i].variable ? "true" : "false");
else
DebugPrintf("Invalid value for boolean variable. Valid values are \"true\", \"false\", \"1\", \"0\", \"yes\", \"no\"\n");
debugPrintf("Invalid value for boolean variable. Valid values are \"true\", \"false\", \"1\", \"0\", \"yes\", \"no\"\n");
break;
// Integer Array
case DVAR_INTARRAY: {
const char *chr = strchr(param[0], '[');
if (!chr) {
DebugPrintf("You must access this array as %s[element]\n", param[0]);
debugPrintf("You must access this array as %s[element]\n", param[0]);
} else {
int element = atoi(chr+1);
int32 *var = *(int32 **)_dvars[i].variable;
if (element >= _dvars[i].arraySize) {
DebugPrintf("%s is out of range (array is %d elements big)\n", param[0], _dvars[i].arraySize);
int32 *var = *(int32 **)_vars[i].variable;
if (element >= _vars[i].arraySize) {
debugPrintf("%s is out of range (array is %d elements big)\n", param[0], _vars[i].arraySize);
} else {
var[element] = atoi(param[1]);
DebugPrintf("(int)%s = %d\n", param[0], var[element]);
debugPrintf("(int)%s = %d\n", param[0], var[element]);
}
}
}
break;
default:
DebugPrintf("Failed to set variable %s to %s - unknown type\n", _dvars[i].name.c_str(), param[1]);
debugPrintf("Failed to set variable %s to %s - unknown type\n", _vars[i].name.c_str(), param[1]);
break;
}
} else {
// And again, type-dependent prints/defrefs. The array one is still ugly.
switch (_dvars[i].type) {
switch (_vars[i].type) {
// Integer
case DVAR_BYTE:
DebugPrintf("(byte)%s = %d\n", param[0], *(const byte *)_dvars[i].variable);
debugPrintf("(byte)%s = %d\n", param[0], *(const byte *)_vars[i].variable);
break;
case DVAR_INT:
DebugPrintf("(int)%s = %d\n", param[0], *(const int32 *)_dvars[i].variable);
debugPrintf("(int)%s = %d\n", param[0], *(const int32 *)_vars[i].variable);
break;
case DVAR_BOOL:
DebugPrintf("(bool)%s = %s\n", param[0], *(const bool *)_dvars[i].variable ? "true" : "false");
debugPrintf("(bool)%s = %s\n", param[0], *(const bool *)_vars[i].variable ? "true" : "false");
break;
// Integer array
case DVAR_INTARRAY: {
const char *chr = strchr(param[0], '[');
if (!chr) {
DebugPrintf("You must access this array as %s[element]\n", param[0]);
debugPrintf("You must access this array as %s[element]\n", param[0]);
} else {
int element = atoi(chr+1);
const int32 *var = *(const int32 **)_dvars[i].variable;
if (element >= _dvars[i].arraySize) {
DebugPrintf("%s is out of range (array is %d elements big)\n", param[0], _dvars[i].arraySize);
const int32 *var = *(const int32 **)_vars[i].variable;
if (element >= _vars[i].arraySize) {
debugPrintf("%s is out of range (array is %d elements big)\n", param[0], _vars[i].arraySize);
} else {
DebugPrintf("(int)%s = %d\n", param[0], var[element]);
debugPrintf("(int)%s = %d\n", param[0], var[element]);
}
}
}
break;
// String
case DVAR_STRING:
DebugPrintf("(string)%s = %s\n", param[0], ((Common::String *)_dvars[i].variable)->c_str());
debugPrintf("(string)%s = %s\n", param[0], ((Common::String *)_vars[i].variable)->c_str());
break;
default:
DebugPrintf("%s = (unknown type)\n", param[0]);
debugPrintf("%s = (unknown type)\n", param[0]);
break;
}
}
@ -326,7 +327,7 @@ bool Debugger::parseCommand(const char *inputOrig) {
}
}
DebugPrintf("Unknown command or variable\n");
debugPrintf("Unknown command or variable\n");
free(input);
return true;
}
@ -405,36 +406,36 @@ char *Debugger::readlineComplete(const char *input, int state) {
#endif
// Variable registration function
void Debugger::DVar_Register(const Common::String &varname, void *pointer, VarType type, int arraySize) {
void Debugger::registerVar(const Common::String &varname, void *pointer, VarType type, int arraySize) {
// TODO: Filter out duplicates
// TODO: Sort this list? Then we can do binary search later on when doing lookups.
assert(pointer);
DVar tmp;
Var tmp;
tmp.name = varname;
tmp.type = type;
tmp.variable = pointer;
tmp.arraySize = arraySize;
_dvars.push_back(tmp);
_vars.push_back(tmp);
}
// Command registration function
void Debugger::DCmd_Register(const Common::String &cmdname, Debuglet *debuglet) {
void Debugger::registerCmd(const Common::String &cmdname, Debuglet *debuglet) {
assert(debuglet && debuglet->isValid());
_cmds[cmdname] = Common::SharedPtr<Debuglet>(debuglet);
}
// Detach ("exit") the debugger
bool Debugger::Cmd_Exit(int argc, const char **argv) {
bool Debugger::cmdExit(int argc, const char **argv) {
detach();
return false;
}
// Print a list of all registered commands (and variables, if any),
// nicely word-wrapped.
bool Debugger::Cmd_Help(int argc, const char **argv) {
bool Debugger::cmdHelp(int argc, const char **argv) {
#ifndef USE_TEXT_CONSOLE_FOR_DEBUGGER
const int charsPerLine = _debuggerDialog->getCharsPerLine();
#elif defined(USE_READLINE)
@ -447,7 +448,7 @@ bool Debugger::Cmd_Help(int argc, const char **argv) {
int width, size;
uint i;
DebugPrintf("Commands are:\n");
debugPrintf("Commands are:\n");
// Obtain a list of sorted command names
Common::Array<Common::String> cmds;
@ -463,103 +464,109 @@ bool Debugger::Cmd_Help(int argc, const char **argv) {
size = cmds[i].size() + 1;
if ((width + size) >= charsPerLine) {
DebugPrintf("\n");
debugPrintf("\n");
width = size;
} else
width += size;
DebugPrintf("%s ", cmds[i].c_str());
debugPrintf("%s ", cmds[i].c_str());
}
DebugPrintf("\n");
debugPrintf("\n");
if (!_dvars.empty()) {
DebugPrintf("\n");
DebugPrintf("Variables are:\n");
if (!_vars.empty()) {
debugPrintf("\n");
debugPrintf("Variables are:\n");
width = 0;
for (i = 0; i < _dvars.size(); i++) {
size = _dvars[i].name.size() + 1;
for (i = 0; i < _vars.size(); i++) {
size = _vars[i].name.size() + 1;
if ((width + size) >= charsPerLine) {
DebugPrintf("\n");
debugPrintf("\n");
width = size;
} else
width += size;
DebugPrintf("%s ", _dvars[i].name.c_str());
debugPrintf("%s ", _vars[i].name.c_str());
}
DebugPrintf("\n");
debugPrintf("\n");
}
return true;
}
bool Debugger::Cmd_OpenLog(int argc, const char **argv) {
bool Debugger::cmdOpenLog(int argc, const char **argv) {
if (g_system->hasFeature(OSystem::kFeatureDisplayLogFile))
g_system->displayLogFile();
else
DebugPrintf("Opening the log file not supported on this system\n");
debugPrintf("Opening the log file not supported on this system\n");
return true;
}
bool Debugger::Cmd_DebugLevel(int argc, const char **argv) {
bool Debugger::cmdDebugLevel(int argc, const char **argv) {
if (argc == 1) { // print level
DebugPrintf("Debugging is currently %s (set at level %d)\n", (gDebugLevel >= 0) ? "enabled" : "disabled", gDebugLevel);
DebugPrintf("Usage: %s <n> where n is 0 to 10 or -1 to disable debugging\n", argv[0]);
debugPrintf("Debugging is currently %s (set at level %d)\n", (gDebugLevel >= 0) ? "enabled" : "disabled", gDebugLevel);
debugPrintf("Usage: %s <n> where n is 0 to 10 or -1 to disable debugging\n", argv[0]);
} else { // set level
gDebugLevel = atoi(argv[1]);
if (gDebugLevel >= 0 && gDebugLevel < 11) {
DebugPrintf("Debug level set to level %d\n", gDebugLevel);
debugPrintf("Debug level set to level %d\n", gDebugLevel);
} else if (gDebugLevel < 0) {
DebugPrintf("Debugging is now disabled\n");
debugPrintf("Debugging is now disabled\n");
} else {
DebugPrintf("Invalid debug level value\n");
DebugPrintf("Usage: %s <n> where n is 0 to 10 or -1 to disable debugging\n", argv[0]);
debugPrintf("Invalid debug level value\n");
debugPrintf("Usage: %s <n> where n is 0 to 10 or -1 to disable debugging\n", argv[0]);
}
}
return true;
}
bool Debugger::Cmd_DebugFlagsList(int argc, const char **argv) {
bool Debugger::cmdDebugFlagsList(int argc, const char **argv) {
const Common::DebugManager::DebugChannelList &debugLevels = DebugMan.listDebugChannels();
DebugPrintf("Engine debug levels:\n");
DebugPrintf("--------------------\n");
debugPrintf("Engine debug levels:\n");
debugPrintf("--------------------\n");
if (debugLevels.empty()) {
DebugPrintf("No engine debug levels\n");
debugPrintf("No engine debug levels\n");
return true;
}
for (Common::DebugManager::DebugChannelList::const_iterator i = debugLevels.begin(); i != debugLevels.end(); ++i) {
DebugPrintf("%c%s - %s (%s)\n", i->enabled ? '+' : ' ',
debugPrintf("%c%s - %s (%s)\n", i->enabled ? '+' : ' ',
i->name.c_str(), i->description.c_str(),
i->enabled ? "enabled" : "disabled");
}
DebugPrintf("\n");
debugPrintf("\n");
return true;
}
bool Debugger::Cmd_DebugFlagEnable(int argc, const char **argv) {
bool Debugger::cmdDebugFlagEnable(int argc, const char **argv) {
if (argc < 2) {
DebugPrintf("debugflag_enable <flag>\n");
debugPrintf("debugflag_enable [<flag> | all]\n");
} else {
if (DebugMan.enableDebugChannel(argv[1])) {
DebugPrintf("Enabled debug flag '%s'\n", argv[1]);
if (!scumm_stricmp(argv[1], "all")) {
debugPrintf("Enabled all debug flags\n");
DebugMan.enableAllDebugChannels();
} else if (DebugMan.enableDebugChannel(argv[1])) {
debugPrintf("Enabled debug flag '%s'\n", argv[1]);
} else {
DebugPrintf("Failed to enable debug flag '%s'\n", argv[1]);
debugPrintf("Failed to enable debug flag '%s'\n", argv[1]);
}
}
return true;
}
bool Debugger::Cmd_DebugFlagDisable(int argc, const char **argv) {
bool Debugger::cmdDebugFlagDisable(int argc, const char **argv) {
if (argc < 2) {
DebugPrintf("debugflag_disable <flag>\n");
debugPrintf("debugflag_disable [<flag> | all]\n");
} else {
if (DebugMan.disableDebugChannel(argv[1])) {
DebugPrintf("Disabled debug flag '%s'\n", argv[1]);
if (!scumm_stricmp(argv[1], "all")) {
debugPrintf("Disabled all debug flags\n");
DebugMan.disableAllDebugChannels();
} else if (DebugMan.disableDebugChannel(argv[1])) {
debugPrintf("Disabled debug flag '%s'\n", argv[1]);
} else {
DebugPrintf("Failed to disable debug flag '%s'\n", argv[1]);
debugPrintf("Failed to disable debug flag '%s'\n", argv[1]);
}
}
return true;

View file

@ -40,7 +40,7 @@ public:
Debugger();
virtual ~Debugger();
int DebugPrintf(const char *format, ...) GCC_PRINTF(2, 3);
int debugPrintf(const char *format, ...) GCC_PRINTF(2, 3);
/**
* The onFrame() method should be invoked by the engine at regular
@ -74,8 +74,8 @@ protected:
* Convenience macro that makes it easier to register a method
* of a debugger subclass as a command.
* Usage example:
* DCmd_Register("COMMAND", WRAP_METHOD(MyDebugger, MyCmd));
* would register the method MyDebugger::MyCmd(int, const char **)
* registerCmd("COMMAND", WRAP_METHOD(MyDebugger, myCmd));
* would register the method MyDebugger::myCmd(int, const char **)
* under the command name "COMMAND".
*/
#define WRAP_METHOD(cls, method) \
@ -89,14 +89,14 @@ protected:
DVAR_STRING
};
struct DVar {
struct Var {
Common::String name;
void *variable;
VarType type;
int arraySize;
};
private:
/**
* Register a variable with the debugger. This allows the user to read and modify
* this variable.
@ -104,11 +104,31 @@ protected:
* @param variable pointer to the actual storage of the variable
* @param type the type of the variable (byte, int, bool, ...)
* @paral arraySize for type DVAR_INTARRAY this specifies the size of the array
*
* @todo replace this single method by type safe variants.
*/
void DVar_Register(const Common::String &varname, void *variable, VarType type, int arraySize);
void DCmd_Register(const Common::String &cmdname, Debuglet *debuglet);
void registerVar(const Common::String &varname, void *variable, VarType type, int arraySize);
protected:
void registerVar(const Common::String &varname, byte *variable) {
registerVar(varname, variable, DVAR_BYTE, 0);
}
void registerVar(const Common::String &varname, int *variable) {
registerVar(varname, variable, DVAR_INT, 0);
}
void registerVar(const Common::String &varname, bool *variable) {
registerVar(varname, variable, DVAR_BOOL, 0);
}
void registerVar(const Common::String &varname, int32 **variable, int arraySize) {
registerVar(varname, variable, DVAR_INTARRAY, arraySize);
}
void registerVar(const Common::String &varname, Common::String *variable) {
registerVar(varname, variable, DVAR_STRING, 0);
}
void registerCmd(const Common::String &cmdname, Debuglet *debuglet);
private:
@ -125,7 +145,7 @@ private:
*/
uint _frameCountdown;
Common::Array<DVar> _dvars;
Common::Array<Var> _vars;
typedef Common::HashMap<Common::String, Common::SharedPtr<Debuglet>, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> CommandsMap;
CommandsMap _cmds;
@ -168,7 +188,7 @@ protected:
virtual void postEnter();
/**
* Subclasses should invoke the detach() method in their Cmd_FOO methods
* Subclasses should invoke the detach() method in their cmdFOO methods
* if that command will resume execution of the program (as opposed to
* executing, say, a "single step through code" command).
*
@ -190,13 +210,13 @@ private:
virtual bool handleCommand(int argc, const char **argv, bool &keepRunning);
protected:
bool Cmd_Exit(int argc, const char **argv);
bool Cmd_Help(int argc, const char **argv);
bool Cmd_OpenLog(int argc, const char **argv);
bool Cmd_DebugLevel(int argc, const char **argv);
bool Cmd_DebugFlagsList(int argc, const char **argv);
bool Cmd_DebugFlagEnable(int argc, const char **argv);
bool Cmd_DebugFlagDisable(int argc, const char **argv);
bool cmdExit(int argc, const char **argv);
bool cmdHelp(int argc, const char **argv);
bool cmdOpenLog(int argc, const char **argv);
bool cmdDebugLevel(int argc, const char **argv);
bool cmdDebugFlagsList(int argc, const char **argv);
bool cmdDebugFlagEnable(int argc, const char **argv);
bool cmdDebugFlagDisable(int argc, const char **argv);
#ifndef USE_TEXT_CONSOLE_FOR_DEBUGGER
private:

File diff suppressed because it is too large Load diff

View file

@ -58,10 +58,10 @@ Codec *createBitmapCodec(uint32 tag, int width, int height, int bitsPerPixel) {
return new CinepakDecoder(bitsPerPixel);
case MKTAG('I','V','3','2'):
return new Indeo3Decoder(width, height);
#ifdef VIDEO_CODECS_TRUEMOTION1_H
#ifdef IMAGE_CODECS_TRUEMOTION1_H
case MKTAG('D','U','C','K'):
case MKTAG('d','u','c','k'):
return new TrueMotion1Decoder(width, height);
return new TrueMotion1Decoder();
#endif
#ifdef USE_MPEG2
case MKTAG('m','p','g','2'):

View file

@ -30,6 +30,7 @@
#include "image/codecs/truemotion1data.h"
#include "common/stream.h"
#include "common/textconsole.h"
#include "common/rect.h"
#include "common/util.h"
namespace Image {
@ -88,24 +89,20 @@ static const CompressionType compressionTypes[17] = {
{ ALGO_RGB24H, 2, 2, BLOCK_2x2 }
};
TrueMotion1Decoder::TrueMotion1Decoder(uint16 width, uint16 height) {
_surface = new Graphics::Surface();
_width = width;
_height = height;
_surface->create(width, height, getPixelFormat());
// there is a vertical predictor for each pixel in a line; each vertical
// predictor is 0 to start with
_vertPred = new uint32[_width];
TrueMotion1Decoder::TrueMotion1Decoder() {
_surface = 0;
_vertPred = 0;
_buf = _mbChangeBits = _indexStream = 0;
_lastDeltaset = _lastVectable = -1;
}
TrueMotion1Decoder::~TrueMotion1Decoder() {
if (_surface) {
_surface->free();
delete _surface;
}
delete[] _vertPred;
}
@ -170,11 +167,6 @@ void TrueMotion1Decoder::decodeHeader(Common::SeekableReadStream &stream) {
byte headerBuffer[128]; // logical maximum size of the header
const byte *selVectorTable;
// There is 1 change bit per 4 pixels, so each change byte represents
// 32 pixels; divide width by 4 to obtain the number of change bits and
// then round up to the nearest byte.
_mbChangeBitsRowSize = ((_width >> 2) + 7) >> 3;
_header.headerSize = ((_buf[0] >> 5) | (_buf[0] << 3)) & 0x7f;
if (_buf[0] < 0x10)
@ -196,6 +188,22 @@ void TrueMotion1Decoder::decodeHeader(Common::SeekableReadStream &stream) {
_header.flags = headerBuffer[11];
_header.control = headerBuffer[12];
if (!_vertPred) {
// there is a vertical predictor for each pixel in a line; each vertical
// predictor is 0 to start with
_vertPred = new uint32[_header.xsize];
}
if (!_surface) {
_surface = new Graphics::Surface();
_surface->create(_header.xsize, _header.ysize, getPixelFormat());
}
// There is 1 change bit per 4 pixels, so each change byte represents
// 32 pixels; divide width by 4 to obtain the number of change bits and
// then round up to the nearest byte.
_mbChangeBitsRowSize = ((_header.xsize >> 2) + 7) >> 3;
// Version 2
if (_header.version >= 2) {
if (_header.headerType > 3) {
@ -240,7 +248,7 @@ void TrueMotion1Decoder::decodeHeader(Common::SeekableReadStream &stream) {
_indexStream = _mbChangeBits;
} else {
// one change bit per 4x4 block
_indexStream = _mbChangeBits + _mbChangeBitsRowSize * (_height >> 2);
_indexStream = _mbChangeBits + _mbChangeBitsRowSize * (_header.ysize >> 2);
}
_indexStreamSize = stream.size() - (_indexStream - _buf);
@ -306,11 +314,11 @@ void TrueMotion1Decoder::decode16() {
int index;
// clean out the line buffer
memset(_vertPred, 0, _width * 4);
memset(_vertPred, 0, _header.xsize * 4);
GET_NEXT_INDEX();
for (int y = 0; y < _height; y++) {
for (int y = 0; y < _header.ysize; y++) {
// re-init variables for the next line iteration
uint32 horizPred = 0;
uint32 *currentPixelPair = (uint32 *)_surface->getBasePtr(0, y);
@ -319,7 +327,7 @@ void TrueMotion1Decoder::decode16() {
byte mbChangeByte = _mbChangeBits[mbChangeIndex++];
byte mbChangeByteMask = 1;
for (int pixelsLeft = _width; pixelsLeft > 0; pixelsLeft -= 4) {
for (int pixelsLeft = _header.xsize; pixelsLeft > 0; pixelsLeft -= 4) {
if (keyframe || (mbChangeByte & mbChangeByteMask) == 0) {
switch (y & 3) {
case 0:

View file

@ -39,7 +39,7 @@ namespace Image {
*/
class TrueMotion1Decoder : public Codec {
public:
TrueMotion1Decoder(uint16 width, uint16 height);
TrueMotion1Decoder();
~TrueMotion1Decoder();
const Graphics::Surface *decodeFrame(Common::SeekableReadStream &stream);
@ -54,7 +54,6 @@ private:
byte *_buf, *_mbChangeBits, *_indexStream;
int _indexStreamSize;
uint16 _width, _height;
int _flags;
struct PredictorTableEntry {

View file

@ -185,10 +185,6 @@ ifdef USE_OPENGL_SHADERS
OSX_STATIC_LIBS += $(STATICLIBPATH)/lib/libglew.a
endif
ifdef USE_TERMCONV
OSX_ICONV ?= -liconv
endif
# Special target to create a static linked binary for Mac OS X.
# We use -force_cpusubtype_ALL to ensure the binary runs on every
# PowerPC machine.
@ -196,8 +192,7 @@ residualvm-static: $(OBJS)
$(CXX) $(LDFLAGS) -force_cpusubtype_ALL -o residualvm-static $(OBJS) \
-framework CoreMIDI \
$(OSX_STATIC_LIBS) \
$(OSX_ZLIB) \
$(OSX_ICONV)
$(OSX_ZLIB)
# Special target to create a static linked binary for the iPhone
iphone: $(OBJS)
@ -297,8 +292,6 @@ else ifeq "$(CUR_BRANCH)" ""
endif
@echo Creating Code::Blocks project files...
@cd $(srcdir)/dists/codeblocks && ../../devtools/create_project/create_project ../.. --codeblocks >/dev/null && git add -f engines/plugins_table.h *.workspace *.cbp
@echo Creating MSVC8 project files...
@cd $(srcdir)/dists/msvc8 && ../../devtools/create_project/create_project ../.. --msvc --msvc-version 8 >/dev/null && git add -f engines/plugins_table.h *.sln *.vcproj *.vsprops
@echo Creating MSVC9 project files...
@cd $(srcdir)/dists/msvc9 && ../../devtools/create_project/create_project ../.. --msvc --msvc-version 9 >/dev/null && git add -f engines/plugins_table.h *.sln *.vcproj *.vsprops
@echo Creating MSVC10 project files...
@ -381,32 +374,5 @@ endif
cp $(srcdir)/README ResidualVM/README.txt
lha a residualvm-amigaos4.lha ResidualVM
#
# PlayStation 3 specific
#
ps3pkg: $(EXECUTABLE)
$(STRIP) $(EXECUTABLE)
sprxlinker $(EXECUTABLE)
mkdir -p ps3pkg/USRDIR/data/
mkdir -p ps3pkg/USRDIR/doc/
mkdir -p ps3pkg/USRDIR/saves/
make_self_npdrm "$(EXECUTABLE)" ps3pkg/USRDIR/EBOOT.BIN UP0001-RESI12000_00-0000000000000000
cp $(DIST_FILES_THEMES) ps3pkg/USRDIR/data/
ifdef DIST_FILES_ENGINEDATA
cp $(DIST_FILES_ENGINEDATA) ps3pkg/USRDIR/data/
endif
cp $(DIST_FILES_DOCS) ps3pkg/USRDIR/doc/
cp $(srcdir)/dists/ps3/readme-ps3.md ps3pkg/USRDIR/doc/
cp $(srcdir)/backends/vkeybd/packs/vkeybd_default.zip ps3pkg/USRDIR/data/
cp $(srcdir)/dists/ps3/ICON0.PNG ps3pkg/
sfo.py -f $(srcdir)/dists/ps3/sfo.xml ps3pkg/PARAM.SFO
pkg.py --contentid UP0001-RESI12000_00-0000000000000000 ps3pkg/ residualvm-ps3.pkg
ps3run: $(EXECUTABLE)
$(STRIP) $(EXECUTABLE)
sprxlinker $(EXECUTABLE)
make_self $(EXECUTABLE) $(EXECUTABLE).self
ps3load $(EXECUTABLE).self
# Mark special targets as phony
.PHONY: deb bundle osxsnap win32dist install uninstall ps3pkg ps3run
.PHONY: deb bundle osxsnap win32dist install uninstall

View file

@ -183,7 +183,7 @@ void AVIDecoder::handleList(uint32 listSize) {
_decodedHeader = true;
break;
case ID_INFO: // Metadata
case ID_PRMI: // Unknown metadata, should be safe to ignore
case ID_PRMI: // Adobe Premiere metadata, safe to ignore
// Ignore metadata
_fileStream->skip(listSize);
return;
@ -322,6 +322,9 @@ bool AVIDecoder::loadStream(Common::SeekableReadStream *stream) {
// Seek back to the start of the MOVI list
_fileStream->seek(_movieListStart);
// Check if this is a special Duck Truemotion video
checkTruemotion1();
return true;
}
@ -658,6 +661,48 @@ void AVIDecoder::forceVideoEnd() {
((AVIVideoTrack *)*it)->forceTrackEnd();
}
void AVIDecoder::checkTruemotion1() {
AVIVideoTrack *track = 0;
for (TrackListIterator it = getTrackListBegin(); it != getTrackListEnd(); it++) {
if ((*it)->getTrackType() == Track::kTrackTypeVideo) {
if (track) {
// Multiple tracks; isn't going to be truemotion 1
return;
}
track = (AVIVideoTrack *)*it;
}
}
// No track found?
if (!track)
return;
// Ignore non-truemotion tracks
if (!track->isTruemotion1())
return;
// Search for a non-empty frame
const Graphics::Surface *frame = 0;
for (int i = 0; i < 10 && !frame; i++)
frame = decodeNextFrame();
if (!frame) {
// Probably shouldn't happen
rewind();
return;
}
// Fill in the width/height based on the frame's width/height
_header.width = frame->w;
_header.height = frame->h;
track->forceDimensions(frame->w, frame->h);
// Rewind us back to the beginning
rewind();
}
VideoDecoder::AudioTrack *AVIDecoder::getAudioTrack(int index) {
// AVI audio track indexes are relative to the first track
Track *track = getTrack(index);
@ -732,6 +777,15 @@ void AVIDecoder::AVIVideoTrack::useInitialPalette() {
}
}
bool AVIDecoder::AVIVideoTrack::isTruemotion1() const {
return _bmInfo.compression == MKTAG('D', 'U', 'C', 'K') || _bmInfo.compression == MKTAG('d', 'u', 'c', 'k');
}
void AVIDecoder::AVIVideoTrack::forceDimensions(uint16 width, uint16 height) {
_bmInfo.width = width;
_bmInfo.height = height;
}
bool AVIDecoder::AVIVideoTrack::rewind() {
_curFrame = -1;
@ -779,6 +833,8 @@ void AVIDecoder::AVIAudioTrack::queueSound(Common::SeekableReadStream *stream) {
_audStream->queueAudioStream(Audio::makeADPCMStream(stream, DisposeAfterUse::YES, stream->size(), Audio::kADPCMMSIma, _wvInfo.samplesPerSec, _wvInfo.channels, _wvInfo.blockAlign), DisposeAfterUse::YES);
} else if (_wvInfo.tag == kWaveFormatDK3) {
_audStream->queueAudioStream(Audio::makeADPCMStream(stream, DisposeAfterUse::YES, stream->size(), Audio::kADPCMDK3, _wvInfo.samplesPerSec, _wvInfo.channels, _wvInfo.blockAlign), DisposeAfterUse::YES);
} else if (_wvInfo.tag == kWaveFormatMP3) {
warning("AVI: MP3 audio stream is not supported");
}
} else {
delete stream;
@ -815,7 +871,7 @@ Audio::AudioStream *AVIDecoder::AVIAudioTrack::getAudioStream() const {
}
Audio::QueuingAudioStream *AVIDecoder::AVIAudioTrack::createAudioStream() {
if (_wvInfo.tag == kWaveFormatPCM || _wvInfo.tag == kWaveFormatMSADPCM || _wvInfo.tag == kWaveFormatMSIMAADPCM || _wvInfo.tag == kWaveFormatDK3)
if (_wvInfo.tag == kWaveFormatPCM || _wvInfo.tag == kWaveFormatMSADPCM || _wvInfo.tag == kWaveFormatMSIMAADPCM || _wvInfo.tag == kWaveFormatDK3 || _wvInfo.tag == kWaveFormatMP3)
return Audio::makeQueuingAudioStream(_wvInfo.samplesPerSec, _wvInfo.channels == 2);
else if (_wvInfo.tag != kWaveFormatNone) // No sound
warning("Unsupported AVI audio format %d", _wvInfo.tag);

View file

@ -185,6 +185,9 @@ protected:
void loadPaletteFromChunk(Common::SeekableReadStream *chunk);
void useInitialPalette();
bool isTruemotion1() const;
void forceDimensions(uint16 width, uint16 height);
bool isRewindable() const { return true; }
bool rewind();
@ -226,6 +229,7 @@ protected:
kWaveFormatPCM = 1,
kWaveFormatMSADPCM = 2,
kWaveFormatMSIMAADPCM = 17,
kWaveFormatMP3 = 85,
kWaveFormatDK3 = 98 // rogue format number
};
@ -257,6 +261,7 @@ protected:
uint16 getStreamType(uint32 tag) const { return tag & 0xFFFF; }
byte getStreamIndex(uint32 tag) const;
void forceVideoEnd();
void checkTruemotion1();
public:
virtual AVIAudioTrack *createAudioTrack(AVIStreamHeader sHeader, PCMWaveFormat wvInfo);