Closed ungesundes-halbwissen closed 5 years ago
Thanks for reporting this. I didn't think much beyond the layout of my own US keyboard when deciding on the keys.
Would Alt+Minus (Alt+-) work for you? If you have a hex editor handy, you could test this by changing the byte at 0x19F4F in U7.EXE from 0x2B to 0x82.
I thought it should, but hex-editing u7.exe to 0x82 did not do the trick - neither the regular "-" nor the numpad one. Frankly, dunno why: minus is available without SHIFT or any other key. I am at a loss atm. :-/
Just - (rather than Alt+-) should be 0x2D 0x00 starting at 0x19F4F (overwriting 0x2B 0x01). Or some other ASCII character followed by 0x00, for that matter. That key is bound here, by the way:
In any case, I trust you know how to start the game with cheats enabled if you need them.
I'll aim to acquire a German keyboard to test all the keys with at some point.
Thanks for all your effort John. Yet again. mapping the cheats to 2d 00 (plain -) works fine. All other "ALT+" mappings like ALT+K work fine by the way, so it cannot be an ALT exclusive problem. Yet, I had no success to map it to ANY ALT keycombination so far. I have gone with SHIFT+c for now (0x43) which works fine. This actually helps me heaps. I ofc know how to start the game with cheats enabled BUT: if you want to use the earthquake fix by ripsaw you cannot have cheats - with your u7hacks working, now you can ;-)
Accordingly, a more permanent fix from your side would be immensly appreciated. I'd even send you an old keyboard of mine if you'd where anywhere nearby Germany? postage to the US is simply out of scope I'm afraid. Also I'd like to offer to translate everything to German, if you'd deem it polssible to include multilingual options in the hacks-patch? It mnakes a welcome addition to my Ultima 7 translation patches :-)
Thx again!
Alt+Backspace seems to be present on many (all?) keyboard layouts. I think I originally avoided using it because I wanted it to be difficult to turn cheats on by accident. (But impossible-on-foreign-keyboards is a bit too difficult.)
(I would say that reading key-binds from a configuration file would be nice, but it would necessitate dynamic generation of text in the controls display.)
Alt+Backspace would be 0E 01.
Just tried it - again to no avail, I'm afraid. Also mapping "#" (0x23) does not work...whatsmore, the latter causes the game to crash. Any chance compiling it from scratch with modified keys can do good here? (I have absoluty zero programming skills, sorry)
Does '#' crash the game for you with just the clean patch applied, without any hex editing? '#' is Shift+3 on a US keyboard, which is supposed to open the third party member's backpack. Sounds like a separate bug if '#' is crashing the game.
Tested this as well: with a clean patch (or any other keymapping for cheating) it works. So my money is on the double-allocation of "#" causing the trouble.
I wasn't aware of the SHIFT+
Could you (or anyone else for that matter) point me to the Hex-addresses in the compiled version of U7hack.exe that define the keys for the SHIFT+
I have tried to search for the characters, but found too many of them to be able to tell, which is the right set to replace.
Background: as I still fail to set up an environment to compile the sources myself (I'm absolutely clueless when it comes to developing), my best chance is to hex-edit the compiled binary :-)
I saw your earlier comment about Enhanced-Keyboard-only keys and thought that was useful information. One of the key combinations listed on that page as Enhanced-only was Alt+Tab, which would be rather sad to live without today.
I'm currently on the move and without a personal computer, but I'll try to remember to look into the Shift+# thing for you when I'm able to.
Is there something in particular that makes it difficult or daunting for you to set up an environment and build the project from source? If there were some documentation or something that I might be able to provide to make it easier for people to answer such questions by themselves, that might be beneficial to me and to the project more generally.
Hi John,
I deleted the enhanced keyboard post after I found out that "ALT+End" works for me despite being labeled as "enhanced only". Hence, I was wrong.... orf more likely: it cannot be the whole truth ;-)
I will try to set up a working environment again and then let you know. My first attempt failed as I was not able to download (clone) the git-repo using git for win. Probably due to some FW restriction. I then downloaded it manually, altered some strings and tried to "nasm file.asm -o file.o". That worked for some files but failed with errors for quite a lot of them. Since I did not find .o files in question for download this is where I stopped fiddling...
As I said: I'll try setting the tools up on another PC and let you know of the outcome :-)
Thanks for spending your time with me and my problems. Much appreciated!!
Ok, I got a bit further.
First off, I'm a windows native and had to adapt all your explanations accordingly. The commands I used on Windows Command line are:
I started in u7bg directory using: for /f %a in ('dir /b *.o') do nasm %a -o %a Please mind: the resulting files are all named name.asm.o - so rename these to .o only
Swtich to UltimaPatcher Directory and run "mvn compile package" no frills here
find the resulting file in \target directory. cd there, copy your u7.exe there as well and run java -jar UltimaPatcher.jar --exe=U7.EXE --expand-overlay=343:0x2000 --write-to-exe
When done finally run: for /f %a in ('dir /b ....\u7bg*.o') do java -jar UltimaPatcher.jar --exe=U7.EXE --patch=....\u7bg\%a --ignore-exe-length --write-to-exe
please note, that without the last two switches, the u7.exe will not be modified
The result however lets you start the game, lets you move your mouse around but nothing else :-(
Would the UltimaPatcher.log be of any help? ultimaPatcher.log
John
Oh! I see. Looks like you're doing everything more or less correct, but the instructions I left on the front README page are out of date.
In truth, I haven't used exactly those commands to build the patches for some time; instead I wrote a shell script for each game to build and apply its patches. I never got around to polishing these scripts for public release, but I see now that I need to do so.
I don't have my computer in front of me to check the exact details, but I believe the substance of the matter is that you now need to expand two overlays rather than one. Going off of the values defined at the top of u7bg.asm, it looks like you need to expand segment 336 to a length of 0x2A00 and expand segment 267 to a length of 0x2100. (And you should not expand overlay 343.) You can provide the two expand-overlay options in one command.
You should never need the ignore-target-length option unless you are patching a different version of the game.
Please let me know how this works for you.
Sort of...
I did what you said and it worked. Afterwards I modified all sources necessary (I did not before) and did everything again.
Now the gamne runs, some hacks work, others don't. (e.g. alt+m / q /
Is this maybe caused by using modified causes? Do I now have to expand other overlays? (log attached) Will it cause issues, whenever I modify the sources?
And most importantly: Am I correct to NOT "nasm" the u7-common directory?
Hmm. I think it would be best for you to run the script that applies all the patches in one go. That way errors along the way - with one patch or another - would probably be easier to track down. I'll get a computer set up and check in the scripts when I can. In the meantime, you would need to get a Unix-style shell set up on your machine in order to run them. On my Windows machine I have mostly used the Bash shell that installs with Git for Windows for this purpose (though just msys2 or even Cygwin, if you were feeling really adventurous, would be able to run the scripts).
Will try to do so. Thanks.
Regardless of the results, it would still be helpful, if you would be able to track down the hex-addresses involved for "SHIFT+
Once the hex-addresses are available I'll happily provide and maintain your patch for users located in UK and France (and whoever else will come up)
Probably I should have it look for and read key codes from an external file; then you wouldn't need to do any hex editing. Maybe HACKKEYS for key codes and HACKSTRS for (externalized) strings.
Sure, that would ofc be easier and also a more permanent, and thus better solution. But from what I have understood in issue #5 when you reopened it, you do not have the time for that anytime soon. Alas, if finding the hex-addresses is less work, I'll go with that for the time being. Whatever floats your boat :-D I just did not want to be assuming or presumptuous.
If you apply just the eop-openableItemForKey patch to U7.EXE, you can see that it writes a block of 0x190 bytes starting at 0xAA39F. The Shift+n key codes ("!", "@", etc.) should be located within that block.
Thanks heaps John! This is simply great. I found the codes. The sequence starts a tad earlier, which is why I did not spot it at once. It's every tenth byte starting from 0xaa385.
For reference, here is the exact location using a a patched version of the original english u7.exe:
SHIFT+1: 0x00AA385 (!)
SHIFT+2: 0x00AA38F (@)
SHIFT+3: 0x00AA399 (#)
SHIFT+4: 0x00AA3A3 ($)
SHIFT+5: 0x00AA3AD (%)
SHIFT+6: 0x00AA3B7 (^)
SHIFT+7: 0x00AA3C1 (&)
SHIFT+8: 0x00AA3CB (*)
John
I ran into one probably last problem, but I cannot even remotely tell, what might be causing this...
The modified patch works fine, despite one character: the section sign (ALT+0167 - HEX A7) which is located at SHIFT+3 on the German keyboard. The only difference to all other keys I can think of is, that the § sign is not present on the US keyboard, but as to why this might cause problems is beyond me. Countercheck: Mapping the byte to some other character, i.e. ")" (SHIFT+9) works as it should Cross-Countercheck: mapping it to a german umlaut does not work (as expected meanwhile)
I have also modified the patch for en_GB keyboards and found someone (with adequate hardware) who is willing to test it. I expect a similar problem with the £ sign (ALT+0163 - Hex A3).
John
Oh, interesting. I wonder whether that is a problem with DOSBox not passing through the key you expect it to. Perhaps some sort of on-screen display of received key codes would be helpful.
Hi John, I just a tested that with, what I think is a good enough workaround. I abused cheatmode, to verify thekey is passed through ok. It is: if you fire up cheat mode, choose to modify an NPC, the prompt waits for the user to input a number. pressing any Umlaut or the section sign there, shows the expected character.
Alas, I'd say, it works fine on this end :-/
I finally got the British version of your patch tested and on the GB keyboard the £ (ALT+163) works flawlessly. Some other problem occured that can be best described as "SHIFT" Key got stuck: Most of the time the patch works as it should, but every now and then you need to press SHIFT+S for the Save dialog (not "S" alone) and pressing "1" open the inventory instead of the paperdoll (as if you have pressed SHIFT+1, not plain 1). I'll try to figure out something reproducable and let you know.
One last key I need to remap is "/" for "casting by key" This key is SHIFT+7 and occupied. Would you please be so kind as to let me know this HEXaddress as well?
Sorry for being such a pain :-/
all the best,
John
The code block for eop-castByKey.o gets put at 0xA92FF, and the '/' should be in that block.
Please do let me know if you track down the stuck key issue.
For future reference, here are all hex-addresses along with the various keyboard mappings:
Original US Layout
SHIFT+1: 0x00AA385 (!)
SHIFT+2: 0x00AA38F (@)
SHIFT+3: 0x00AA399 (#)
SHIFT+4: 0x00AA3A3 ($)
SHIFT+5: 0x00AA3AD (%)
SHIFT+6: 0x00AA3B7 (^)
SHIFT+7: 0x00AA3C1 (&)
SHIFT+8: 0x00AA3CB (*)
German Mapping
SHIFT+1: 0x00AA385 (!)
SHIFT+2: 0x00AA38F (")
SHIFT+3: 0x00AA399 (W)
SHIFT+4: 0x00AA3A3 ($)
SHIFT+5: 0x00AA3AD (%)
SHIFT+6: 0x00AA3B7 (&)
SHIFT+7: 0x00AA3C1 (/)
SHIFT+8: 0x00AA3CB (()
Cheats: 0x0019F4F (9F=ALT+ENDE)
Casting 0x00A93F2 (\)
Swiss Mapping
SHIFT+1: 0x00AA385 (+)
SHIFT+2: 0x00AA38F (")
SHIFT+3: 0x00AA399 (*)
SHIFT+4: 0x00AA3A3 (ç)
SHIFT+5: 0x00AA3AD (%)
SHIFT+6: 0x00AA3B7 (&)
SHIFT+7: 0x00AA3C1 (/)
SHIFT+8: 0x00AA3CB (()
Cheats: 0x0019F4F (9F=ALT+ENDE)
Casting 0x00A93F2 (\)
French Mapping
SHIFT+1: 0x00AA385 (&)
SHIFT+2: 0x00AA38F (é)
SHIFT+3: 0x00AA399 (")
SHIFT+4: 0x00AA3A3 (')
SHIFT+5: 0x00AA3AD (()
SHIFT+6: 0x00AA3B7 (-)
SHIFT+7: 0x00AA3C1 (è)
SHIFT+8: 0x00AA3CB (_)
Cheats: 0x0019F4F (ALT+\)
Casting 0x00A93F2 (/)
UK Mapping
SHIFT+1: 0x00AA385 (!)
SHIFT+2: 0x00AA38F (@)
SHIFT+3: 0x00AA399 (£)
SHIFT+4: 0x00AA3A3 ($)
SHIFT+5: 0x00AA3AD (%)
SHIFT+6: 0x00AA3B7 (^)
SHIFT+7: 0x00AA3C1 (&)
SHIFT+8: 0x00AA3CB (*)
Cheats: 0x0019F4F (ALT+\)
Casting 0x00A93F2 (/)
By now I have successfully remapped all keys for the German layout and created .exe files for french, swiss and UK keyboard layouts, which I want to make available for download here: https://sirjohn.de/en/ultima7/u7hacks/ I hope that's ok? Since there still is another issue open to externalize the strings involved, I think it is safe to close this one.
As for the "Stuck key issue" - I have asked the tester to track the issue down to something reproducable, but as of yet the error did not come up again. If it reoccurs and I can come up with something to track down, I'll open a new issue for it.
Thanks for all your work, help and support. I really appreciate this!!
I have just (finally) updated my build scripts and added them to the git repository, and also updated the build instructions in the front-page README. If you get some spare time to play with this again, I'd be interested to hear whether you are able to build and apply these patches yourself, perhaps with altered key bindings.
Hi John,
I have finally come round to give this another go and installed the environment again, downloaded the latest master and translated some of the files. Creating UltimaPatcher.jar worked fine, and calling the PatchFreshExe.sh starts ok but aborts soon afterwards.
StdOutput:
John@DESKTOP-Shuttle MINGW64 /f/Ultima/Ult-hacks/UltimaHacks-master/u7bg
$ ../scripts/patchFreshExe.sh *.asm
copying clean executable...
deleting old binaries...
assembling patches...
ambientSounds.asm
call-eop-barkOverItemInWorld.asm
call-eop-determineItemBulk.asm
call-eop-processSliderInput.asm
conversationKeys.asm
dontMessWithFsAndGs.asm
drawDarkenedWorldForConversation.asm
dropToKeySelectedItem.asm
eop1-dispatchTable.asm
eop1-entryPoints.asm
eop1-varArgsDispatcher.asm
eop2-dispatchTable.asm
eop2-entryPoints.asm
eop2-varArgsDispatcher.asm
eop-barkOverItemInWorld.asm
eop-canItemAcceptItems.asm
eop-castByKey.asm
eop-cycleInventoryDialogs.asm
eop-determineItemBulk.asm
eop-displayControls.asm
../u7-common/patch-eop-displayControls.asm:224: error: (endBlockWithFillAt:7) block overrun
../UltimaPatcher.asm:88: ... from macro `endBlockAt' defined here
../UltimaPatcher.asm:74: ... from macro `endBlockWithFillAt' defined here
../u7-common/patch-eop-displayControls.asm:224: error: TIMES value -247 is negative
../UltimaPatcher.asm:88: ... from macro `endBlockAt' defined here
../UltimaPatcher.asm:80: ... from macro `endBlockWithFillAt' defined here
John@DESKTOP-Shuttle MINGW64 /f/Ultima/Ult-hacks/UltimaHacks-master/u7bg
$
A quick check of modified and downloaded files shows all have a "LF" line break and are coded in ANSI.... no differences I can see
Oh, excellent! The error messages indicate that you've put 247 more bytes than fit within the designated space ending at line 224 in the patch-eop-displayControls.asm file (which is included and parameterized by a separate eop-displayControls.asm file for each of u7bg and u7si).
Probably your translated text there takes up more space than the original text.
I'm not sure exactly why that is the case - do you need more bytes for the translation, or has there been a mistake somehow that caused more bytes to be included by mistake? Of course, all the text needs to fit within the "book" pages when displayed in-game, so it can't be too long.
Hm, I'm not sure, I get it. Sure, my text length differs from the original one....I thought that was the point in creating the patches from scratch scratches head Is it this you are saying or did I get it wrong? German tends to be ~20% longer than English. If I need to have the exact amount of bytes per string, there will be no difference to hex-editing qualitywise.
For reference, here's the german strings I tried to compile
db "~TASTEN"
db "~a: Audio (Ein/Aus)"
db "~c: Kampfmodus (Ein/Aus)"
db "~f: Begleiter füttern"
db "~h: Maushand wechseln"
db "~k: Schlüssel(-ring) benutzen"
db "~q: in Bewegung bleiben (s. u.)"
db "~s: Spielstände Dialog"
db "~t: Anvisieren (s. u.)"
db "~v: Anzeige Spielversion"
db "~/: Zaubern [über Tasten] (s.u.)"
db "~Alt+x: Spiel verlassen"
db "~Alt+m: PC-Speicherinfo anzeigen"
db "~Alt+Ende: Cheatmodus (Ein/Aus)"
db "~Space: starte Tastatur-Maus"
db "~Numpad/Pfeile: bewegen"
%ifdef combatStatusLine
db combatStatusLine
%else
db "~"
%endif
db "~"
db "~MAUS"
db "~MB1: Gegenstand benennen"
db "~Shift+MB1: Zeigt das Gewicht"
db "~Strg+MB1: Zeigt das Volumen"
db "~Alt+MB1: Zeigt Inhalt e.Sache"
%ifdef altMb1Line
db altMb1Line
%endif
db "~2xMB1: Benutze (im Kampf: Angriff)"
db "~MB2: Bewegen"
db "~2xMB2: Bewegen zu diesem Punkt"
db "~"
db "~IN BEWEGUNG BLEIBEN"
db "~q,Q: einschalten; Geschwindigkeit bestimmen"
db "~"
db "~Hält den Avatar in der letzten Richtung in Bewegung."
db " Gehen/Laufen/Rennen. Numpad oder Pfeile für Richtungswechsel."
db " Jede andere Taste zum stoppen."
db 0
controlsText2:
db "~GRUPPENMITGLIEDER ÜBER ZAHLEN"
db "~<n>: Begleiter Nr. (1-8)"
db "~Shift+<n>: öffne <n>'s Rucksack"
db "~Alt+Shift+<n>: Zeigt <n>'s Werte"
db "~Gegenstand ziehen,<n>: G. <n> geben"
db "~"
db "~Mitgliedsnummer drücken um ihr Inventar zu öffnen"
db " oder es im Fadenkreuz-Modus anzuvisieren."
db "~"
db "~ZU BENUTZENDE GEGENSTÄNDE"
db "~b: Zauberbuch/-bücher"
db "~g: Abakus (Geld zählen)"
db "~m: Weltkarte"
db "~p: Dietriche"
db "~x: Sextant"
%ifdef keyUsableItemLineX2
db keyUsableItemLineX2
%else
db "~"
db "~"
%endif
db "~ANVISIEREN"
db "~Während des Fadenkreuz-Modus."
db "~"
db "~<n>: Begleiter auswählen"
db "~t,T: NPCs durchwechseln"
db "~r,R: Nutzbare Gegenstände durchgehen"
db "~a,A: Alle Gegenstände durchgehen"
db "~Enter: wählen/sprechen/benutzen"
db "~Esc: abbrechen"
db "~"
db "~g,G: aufnehmbare Gegenstände durchgehen"
db "~g,Enter: auf Avatar fokussieren"
db "~g,<n>: auf Begleiter fokussieren"
db "~"
db "~im Kampf:"
db "~t,Enter: Angriff mit Gruppe"
db "~t,<n>: Angriff mit <n>"
db 0
controlsText3:
db "~ZAUBERN ÜBER TASTEN"
db "~Benötigt ein Zauberbuch."
db "~"
db "~/: Beginne Zauber"
db "~a-z: eine Rune hinzufügen"
db "~Enter: versuchen zu zaubern"
db "~Esc: Zauber abbrechen"
db "~"
db "~Um anzuzeigen, welche Buchstabe, ein Zauber braucht,"
db " SHIFT drücken, während das Zauberbuch gelesen wird."
db "~"
%ifdef frioRuneKeyLine
db frioRuneKeyLine
%else
db "~"
%endif
db "~"
db "~"
db "~"
db "~"
db "~"
db "~DIALOG TASTEN"
db "~Enter/Space/Strg: Textvorschub, Antwort auswählen"
db "~(Shift+)Tab/Links/Rechts: Antworten durchwechseln"
db "~"
db "~Diese Tasten blättern ebenso Text in"
db " Büchern, Schriftrollen und Schildern weiter."
db "~"
db "~MENGENREGLER"
db "~(Shift+)Links/Rechts: Wert verändern"
db "~Hoch/Runter: Setzt den Wert auf min/max"
db "~Enter oder MB2: Wert übernehmen"
db "~"
db "~INVENTARDIALOGE"
db "~Tab: Zwischen Inventaren wechseln"
db "~MB2: Inventardialog schließen"
db 0
controlsText4:
db "~BEISPIELE"
db "~f,3: Füttere Begleiter 3"
db "~"
db "~t,2: Begleiter 2 ansprechen"
db "~"
db "~/,v,m,Enter,4: Zaubere Große Heilung"
db " (Vas Mani) für Begleiter 4"
db "~"
db "~t,g,g,3: Begleiter 3 nimmt nahen Gegenstand auf"
db "~"
db "~t,t,t,2: (im Kampf) Begleiter 2 soll"
db " nächsten NPC angreifen"
Space can be expanded to accommodate your translations, but I'm not yet sure of the right way to go about doing that.
In particular, probably there will be other places throughout the code where the translated text is similarly too long to fit, in which case this endeavor could not be completed until I were to externalize strings to a single place (which could then be expanded in size, all at once, to accommodate lengthier text).
Also, you should ensure that your lengthier German text for the controls display fits nicely in the displayed book pages. You can see the 4 blocks of code calling displayCsTextInBook, referencing the 4 strings of text below. It should be easy enough for you to split the text into 5 strings and have 5 calls to displayCsTextInBook instead. Should be almost just copy-paste. (At some point I might change this procedure to detect the number of these strings and loop over them, so that this copy-paste would not be needed.)
As a temporary workaround for the display-controls text, you could expand the eop-displayControls procedure and the segment within which it resides with the following edits: change 0x950 to 0xAD0 in include/u7bg-eop2.asm change 0x2100 to 0x2280 in include/u7bg.asm change 0x2100 to 0x2280 in patchingVariables.sh (For a final version, these numbers could then be lowered to more closely fit the actual number of bytes needed without taking up too much unnecessary space.)
Hopefully changing the keyboard controls won't be this complicated : )
I'm having a similar problem in U7BG with the Swedish keyboard layout. Shift-1
to open the backback works as expected, but Shift-2
does nothing. I have to press AltGr-2
to open that one. This is with a 105 key ISO style keyboard.
Also, Alt-1
and Alt-2
do nothing. Here it's Shift-Alt-1
and Shift-Alt-2
that work. 😄 (either Shift
key)
Not sure about other party members, just started the game.
Changing to keyb us
before starting the game seems to work fine. 👍 Just thought I'd share.
First off: thanks for all your effort! VERY much appreciated!
The hacks work totally fine for the German version of Black Gate - save the toggle cheats function.
Reason being is, that "\" is located on the English Underscore/Dash key and the ALTGR key is needed to produce a backslash. Hence, ALT+ALTGR+\ does not work. Any chance to move the function to another key, e.g. "-"?
see https://en.wikipedia.org/wiki/German_keyboard_layout