Author Topic: Adding Set/Clear Flag and Set Skill to QFG1VGA's existing debug  (Read 4667 times)

0 Members and 1 Guest are viewing this topic.

Offline lwc

Adding Set/Clear Flag and Set Skill to QFG1VGA's existing debug
« on: September 17, 2023, 05:21:52 AM »
Quest for Glory 1 VGA is the only game in the SCI series to not allow adding a specific skill (usually Alt+K), could you modify it to do that and thus assist in this game's debugging?

You can see it requested on https://tcrf.net/Quest_for_Glory:_So_You_Want_to_Be_a_Hero_(1992)#Debug_Mode but note Alt+K is already taken, but Alt+M and Alt+N are vacant...

Thanks!
« Last Edit: September 18, 2023, 01:53:21 AM by lwc »



Offline doomlazer

Re: Adding Set Skill to QFG1VGA's existing debug
« Reply #1 on: September 17, 2023, 03:43:33 PM »
The TCRF link seems to use the exported script from another game, which kinda works but it looks like EO's QfQ1VGA debug script is what you want. It already has an ALT+K command for skills. It's surprisingly easy to export when you know the steps:

Download and install SCICompanion. Kawa's latest version is recommended. Click assets under the most recent nightly build and download the SCICompanion-Kawa-Win32-20XX-XX-XX.zip file.

Download EO's SCI Decompile Archive.  Click the green 'Code' button near the top right and select 'Download Zip'.

Backup your QfG1VGA game folder or create a copy to use with these steps.

Copy the contents of SCI-Decompilation-Archive/qfg1vga/ (999.voc, game.ini, folders scr & msg) into your QfG1VGA game folder replacing the existing game.ini.

Launch SCICompanion and select File > Open Game. Navigate to your QfG1VGA game folder, choose the RESOURCE.MAP file and click open.

From the SCICompanion menu select Script > Compile All. You'll see several warnings generated at the bottom which can safely be ignored. In my test EO's QfG1VGA source files compile with no errors.

There is a row of tabs a bit below the menu (see image). Click Scripts, Scroll down to #298 (Debug), right-click and choose export as patch file.

Click the Heaps tab. If the heaps tab is not visible extend the SCICompanion window lengthwise until it appears. Scroll down to heap number 298 (n298), right-click and choose export as patch file.

Copy your new patches 298.scr and 298.hep into a clean version of QfG1VGA and launch. You should see the 'Where to?' popup.


Notes:

298.txt is not needed in this scenario (and doesn't exist) because all of the string literals are in 298.hep.
 
After 'Compile All' you could choose from the SCICompanion menu Tools > Rebuild Resources. This will update the game's RESOURCE.XXX files with the changes in the new scripts. Individual scripts that contain errors will not be updated in the resource.xxx files, but any script that compiled successfully will add/update to the new version of the script.

This process is the same for compiling Sluicebox's scripts, but be aware that many games in both Sluice's and EO's archives will generate some errors out of the box. Fixing those errors is outside the scope of this post.

If the resource tabs are not visible in SCICompanion, click the grey 'Explorer' tab near the top-left to show them (marked in attached image).

« Last Edit: September 17, 2023, 03:49:43 PM by doomlazer »

Offline lwc

Re: Adding Set Skill to QFG1VGA's existing debug
« Reply #2 on: September 17, 2023, 03:51:38 PM »
Are you sure? TCRF (as well as this site's wiki) suggests the other game's debug triggers just the WhereTo, while everything else already only comes from EO (in which Alt+K is Show Pallete).

Offline doomlazer

Re: Adding Set Skill to QFG1VGA's existing debug
« Reply #3 on: September 17, 2023, 03:56:54 PM »
I'm never sure about anything, but EO's debugger states: "ALT-K set one of ego's sKills".

Code: [Select]
Key commands:
ALT-A show cAst
ALT-O create Obstacles
ALT-F (vacant)
ALT-W Write features
ALT-Y (vacant)
ALT-R show Room
ALT-E (vacant)
ALT-M show Memory
ALT-T Teleport
ALT-V Visual
ALT-P Priority
ALT-C Control
ALT-I get InvItem
ALT-S (vacant)
ALT-G Set/Clear flag
ALT-B set ego's Bucks
ALT-D toggle debugging
ALT-H set Hour of day
ALT-K set one of ego's sKills
ALT-X make ego eXtra special
ALT-U return User control and input
CTRL-L note Logger

FYI, from game.sh

Code: [Select]
skills
STR 0
INT 1
AGIL 2
VIT 3
LUCK 4
WEAPON 5
PARRY 6
DODGE 7
STEALTH 8
PICK 9
THROW 10
CLIMB 11
MAGIC 12
EXPER 13
HEALTH 14
STAMINA 15
MANA 16

Magic Spells
OPEN 17
DETMAGIC 18
TRIGGER 19
DAZZLE 20
ZAP 21
CALM 22
FLAMEDART 23
FETCH 24

Inventory
iSilver 040
iRations 1
iSword 2
iChainmail 3
iLeather 4
iShield 5
iDagger 6
iLockPick 7
iThiefKit 8
iThiefLicense 9
iRock 10
iFlask 11
iHealingPotion 12
iManaPotion 13
iStaminaPotion 14
iDisenchant 15
iBrassKey 16
iMagicGem 17
iRing 18
iGhostOil 19
iMagicMirror 20
iMandrake 21
iFruit 22
iVegetables 23
iAcorn 24
iSeed 25
iFlowers 26
iGreenFur 27
iFairyDust 28
iFlyingWater 29
iMushroom 30
iVase 31
iCandelabra 32
iMusicBox 33
iCandlesticks 34
iPearls 35
iCheetaurClaw 36
iTrollBeard 37
iGold 38
iPaper 39
« Last Edit: September 17, 2023, 04:21:43 PM by doomlazer »

Offline lwc

Re: Adding Set Skill to QFG1VGA's existing debug
« Reply #4 on: September 17, 2023, 04:32:10 PM »
The list is already expanded in TCRF. But I see last year you documented Alt+K as Show Pallete in https://github.com/Doomlazer/SCI-Debug-Resources/tree/main/QfG1/Quest%20for%20Glory%20VGA%20remake and you've mentioned it's from PQ1SCI, doesn't it mean http://sciwiki.sierrahelp.com//index.php?title=SCI_Debug_Modes#Quest_for_Glory_.28VGA_remake.29 is wrong?

If so, someone will have to decide which debug is better. ;)

In any case, could you provide a ZIP of just the needed extracted files of EO's debug version?

Last but not least, Sluicebox' archive has no debug files at all for this game, right?

Offline doomlazer

Re: Adding Set Skill to QFG1VGA's existing debug
« Reply #5 on: September 17, 2023, 04:45:46 PM »
If the files from TCRF are from my debug repo, then they are likely a modified version of the PQ1SCI debugger. I don't recall the timeline but it might have been created before EO's restoration.

Edit: I don't think the version on TCRF is from me. On TCRF, Alt-X is 'Set all hero's skills', which mine does not include. Someone else must have hacked together that version.

I've updated my repo to include both EO's version and my PQ1SCI based version (now in the 'Old Version' folder). You can download the patch files from there.

As for which is better? That's subjective. EO's is likely much more historically accurate. The version on TCRF is probably superior to my old PQ1SCI attempt as it contains QfG1 specific commands.

It info currently on SCIWiki isn't necessarily wrong, it just describes using the exported PQ1SCI debugger in QfG1VGA, which isn't really needed now that the TCRF and EO's versions can be used instead.

Sluice's repo doesn't include the debugger because the script doesn't exist in any of the QfG1VGA versions. If Sierra shipped a game without removing the script, his will have it, otherwise it's missing.
« Last Edit: September 17, 2023, 05:26:28 PM by doomlazer »

Offline Collector

Re: Adding Set Skill to QFG1VGA's existing debug
« Reply #6 on: September 17, 2023, 10:58:14 PM »
It info currently on SCIWiki isn't necessarily wrong, it just describes using the exported PQ1SCI debugger in QfG1VGA, which isn't really needed now that the TCRF and EO's versions can be used instead.

This is mostly what I am looking for in all of this. I want to update the Wiki with all the new debug files and info.
KQII Remake Pic

Offline lwc

Re: Adding Set Skill to QFG1VGA's existing debug
« Reply #7 on: September 18, 2023, 01:52:06 AM »
It info currently on SCIWiki isn't necessarily wrong, it just describes using the exported PQ1SCI debugger in QfG1VGA, which isn't really needed now that the TCRF and EO's versions can be used instead.
But it states PQ1VGA just gives a WhereTo screen while you state it gives whole debug options.

Do you think you can do a mix of all options?
I believe TCRF's version misses only:
  • Setting/clearing flags
  • Setting specific skills
The other version misses:
  • Change GLOBAL variable
  • Show GLOBAL variable
  • Set Date (not just Hour)
  • Show hero info
  • Show palette (although I guess one can live without it)
  • Learn spell (without which Alt + I is worthless for spells!)
  • Instant movement
  • Show position
And perhaps useless stuff:
  • QA Note Logger
  • Set detail to 1
  • Show a string or message
  • Polygon Editor
  • Quick quit

About the bold part, attached is what happens (and if you already have at least 1 spell, if you set skills of another, then it just doesn't show up in the spell list).
« Last Edit: September 19, 2023, 11:32:03 AM by lwc »

Offline Collector

Re: Adding Set/Clear Flag and Set Skill to QFG1VGA's existing debug
« Reply #8 on: September 18, 2023, 09:35:48 AM »
The debug modes list on the wiki started life as the one that HWM created back in '06. Omer Mor, Lars Skovlund and Kelmer have contributed some information. Much of the information on the ScummVM wiki originates from the same sources (the Free SCI documents, HWM's lists, etc.) but has probably been more consistently updated. Some of the SCI Wiki may be out of date, but it has always been an evolving document. However it has not been updated for some time. This new influx of debug files and info is why I want to start updating it again.
KQII Remake Pic

Offline doomlazer

Re: Adding Set/Clear Flag and Set Skill to QFG1VGA's existing debug
« Reply #9 on: September 19, 2023, 03:54:15 AM »
I need to update all the SCI.EXE versions to 1.KAWA.044. They are at 1.KAWA.001  :o

With SCI.EXE's debugger I can view the bytecode of an object's method, but how do I convert the es & si registers into a heap value that I can overwrite with the debugger's 'e' command?

Offline lskovlun

Re: Adding Set/Clear Flag and Set Skill to QFG1VGA's existing debug
« Reply #10 on: September 19, 2023, 04:53:34 AM »
ES:SI points to the bytecode in hunk (since this is SCI1.1). I believe the debugger is not designed to edit hunk memory. What exactly do you want to achieve?

Offline doomlazer

Re: Adding Set/Clear Flag and Set Skill to QFG1VGA's existing debug
« Reply #11 on: September 19, 2023, 11:31:38 AM »
Just wanting to overwrite the bytecode at ES:SI for fun. I thought could arbitrarily write to ES+(SI*16) or something to do it, but maybe that's not possible or I'm doing something wrong? 

Offline lwc

Re: Adding Set Skill to QFG1VGA's existing debug
« Reply #12 on: September 19, 2023, 11:33:39 AM »
I believe TCRF's version misses only:
  • Setting/clearing flags
  • Setting specific skills
Do you think you can add those (especially as the other version misses much more and contains aforementioned bugs)?  :D

Offline doomlazer

Re: Adding Set/Clear Flag and Set Skill to QFG1VGA's existing debug
« Reply #13 on: September 19, 2023, 11:41:55 AM »
I believe TCRF's version misses only:
  • Setting/clearing flags
  • Setting specific skills
Do you think you can add those (especially as the other version misses much more and contains aforementioned bugs)?  :D

Probably in the near future, but I'm studying the ScummVM and SCI.EXE debuggers at the moment. There's a lot of stuff I'm still trying to understand

Offline doomlazer

Re: Adding Set/Clear Flag and Set Skill to QFG1VGA's existing debug
« Reply #14 on: September 24, 2023, 04:44:16 PM »
I updated TCRF debugger version to include:

Alt-M - Set specific skill
Alt-N - Set/Clear flag

Attached below.


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.042 seconds with 23 queries.