Giter VIP home page Giter VIP logo

Comments (46)

dbalsom avatar dbalsom commented on May 24, 2024 2

After consulting the Rust discord it looks like this is a bug in a dependency (winit), which has been fixed in a later version (0.29). This version includes a complete re-write of the library's keyboard handling. I am going to work on upgrading the dependency today; there are a few breaking changes with the keyboard interface, but if it works I will make a new release along with the new composite stuff.

from martypc.

dbalsom avatar dbalsom commented on May 24, 2024 1

I don't want people to have to wait for egui to update to winit 0.29, especially since it's in beta and I haven't seen a pull request to even start on it yet. So I forked egui and I will update it myself.

edit: Good news is that it appears the main bug is fixed, bad news is that there are some brand new bugs now. I'm still learning how the new keyboard system in 0.29 works. You can get physical or logical keyboard events, and logical events return strings now instead of characters.

from martypc.

dbalsom avatar dbalsom commented on May 24, 2024 1

Could either of you build branch 0_1_3 and tell me if the issue is fixed?

It requires the rust msvc toolchain ?

yeah building on windows is a bit of a pain, you'd need to install msvc/visual studio... I can make a 'test release' here in a bit for you to try

edit: https://github.com/dbalsom/martypc/releases/tag/0.1.3_testing Drop the executable over the 0.1.2 release

from martypc.

dbalsom avatar dbalsom commented on May 24, 2024 1

the new keyboard system is based on physical scancode, so in theory, you would need to set the keyboard layout in the emulated machine and it should work.

If you have DOS 3.30 or later loaded, try typing

KEYB IT,850 C:\DOS\KEYBOARD.SYS

more info:
http://info.wsisiz.edu.pl/~bse26236/batutil/help/KEYB_S.HTM

from martypc.

dbalsom avatar dbalsom commented on May 24, 2024 1

to get into ROM basic you can't have a hard disk installed or a floppy disk inserted. so make sure your hdc="None"

to expand on this some, it was expected for most users to use the BASICA interpreter once DOS was installed. This actualy uses the ROM basic and extends it, adding disk support and other things.

from martypc.

dbalsom avatar dbalsom commented on May 24, 2024 1

@dbalsom the layouts of the keyboards are in this manual i've found:

oh wow this is great! thanks!

from martypc.

dbalsom avatar dbalsom commented on May 24, 2024 1

well I missed the absolute most obvious way to debug this. I added the Italian keyboard layout to windows, and now when I switch to it the Windows OSD switches to Italian layout:

image

from martypc.

dbalsom avatar dbalsom commented on May 24, 2024 1

Thanks for being patient; I'm working on an all-new keyboard system for 0.1.4. It's a big change, but it lays the groundwork for supporting additional keyboard types, like the Model M enhanced keyboard. Now we ignore the host typematic repeat rate, and run the keyboard along with other devices so we have a configurable typematic delay and repeat rate for the emulated machine.

This should improve compatibility in certain titles when the host has a fast typematic repeat rate set that was filling the keyboard buffer too quickly.

In addition, the new keyboard system supports keyboard translation files, so that we can synthesize scancodes based on modifier state, this should assist in mapping modern International keyboard layouts to their 1980's equivalents, based on the emulated keyboard model. This system is pretty flexible, and you can add arbitrary keys to it, so if you want to map say, the "volume up" multimedia key on your keyboard (which obviously has no 1980's equivalent) to an arbitrary series of scancodes to effectively make a custom macro, you can do so.

I am working on a translation file for the Italian layout, and I suppose I will try to cover most of the major European countries, but I may need help from my users to contribute new translation files.

from martypc.

dbalsom avatar dbalsom commented on May 24, 2024 1

Ok, got a little demo of the remapping system in action.
https://www.youtube.com/watch?v=qEV8z-4kGV8

For something so simple, this was surprisingly complicated, but I think the remapping system will be quite flexible.

You can see the last three shift-keys did not produce the same characters on a modern keyboard. This could be addressed too, I just mainly made mappings for the three problematic keys so far. You'll be able to toggle mapping off as well if you want to have a raw 1980's keyboard experience.

I'll try to put up a test build soon so you can try it out.

from martypc.

dbalsom avatar dbalsom commented on May 24, 2024 1

0.2.0 is finally out with keyboard translation support. I have some documentation to update, but hopefully this takes care of things. Feel free to open a new issue if you're still having problems in 0.2.0.

from martypc.

dbalsom avatar dbalsom commented on May 24, 2024 1

I found the problem... I missed a line in the config in the release :P

add this line to the paths array under [emulator]

{ resource = "keyboard_layout", path = "$basedir$/configs/keyboard_layouts", create = false },

if successful you should see this printed out as one of the last lines when starting martypc from console:

Loaded keyboard mapping file: ./configs/keyboard_layouts\keyboard_IT.toml

from martypc.

dbalsom avatar dbalsom commented on May 24, 2024 1

Awesome! I even bought an italian keyboard on ebay so I wanted to make sure it worked. Still have to make mappings for other layouts. I think we also have to add altgr scancodes.

from martypc.

graphixillusion avatar graphixillusion commented on May 24, 2024

Yep i have the same issue on Windows

from martypc.

dbalsom avatar dbalsom commented on May 24, 2024

A few questions for you both, if you will:

  1. what kind of keyboard layout? US or some other layout?
  2. Which BIOS are you both using?
  3. is this a laptop keyboard or desktop/external keyboard?
  4. does the web player work?
    https://dbalsom.github.io/martypc/web/player.html?title=freedos

from martypc.

chungy avatar chungy commented on May 24, 2024

what kind of keyboard layout? US or some other layout?

US international with AltGr dead keys. Same issues persist if I switch to standard US layout.

Which BIOS are you both using?

Tried copying the "preferred" 5160 ROM files from the MAME set, didn't work, the second set listed in the roms.txt file worked to boot. I have all four files in the directory with the same names the txt file specifies. (Separate issue, I suppose)

is this a laptop keyboard or desktop/external keyboard?

Desktop.

does the web player work? https://dbalsom.github.io/martypc/web/player.html?title=freedos

Yes, it does.

from martypc.

dbalsom avatar dbalsom commented on May 24, 2024

Tried copying the "preferred" 5160 ROM files from the MAME set, didn't work, the second set listed in the roms.txt file worked to boot. I have all four files in the directory with the same names the txt file specifies. (Separate issue, I suppose)

the names are ignored really, only the md5sum matches; is the md5 the same as what's listed here?
https://github.com/dbalsom/martypc/wiki/ROMs

from martypc.

chungy avatar chungy commented on May 24, 2024

Yes, they're the same, but the emulator doesn't accept them.

from martypc.

graphixillusion avatar graphixillusion commented on May 24, 2024

A few questions for you both, if you will:

  1. what kind of keyboard layout? US or some other layout?
  2. Which BIOS are you both using?
  3. is this a laptop keyboard or desktop/external keyboard?
  4. does the web player work?
    https://dbalsom.github.io/martypc/web/player.html?title=freedos
  1. I'm using IT layout;
  2. I'm using the preferred bios in the wiki page:
BIOS_5160_09MAY86_U19_62X0819_68X4370_27256_F000.BIN  **** preferred ****
    32,768 bytes
    md5sum: f051b4bbc3b60c3a14df94a0e4ee720f
-- and --

    BIOS_5160_09MAY86_U18_59X7268_62X0890_27256_F800.BIN  **** preferred ****
    32,768 bytes
    md5sum: 9696472098999c02217bf922786c1f4a
  1. It's a laptop keyboard, integrated one
  2. yep, the web player works, for my layout is shift+ò to make ":"

from martypc.

dbalsom avatar dbalsom commented on May 24, 2024

Unfortunately the egui binding for winit is still stuck at 0.28, and would need to be updated for the new keyboard events in 0.29. Maybe theres some other workaround.

I tried to reproduce by adding the Italian keyboard layout to Windows but I can still use the shift key and type characters on the number row...

from martypc.

dbalsom avatar dbalsom commented on May 24, 2024

Could either of you build branch 0_1_3 and tell me if the issue is fixed?

from martypc.

graphixillusion avatar graphixillusion commented on May 24, 2024

Could either of you build branch 0_1_3 and tell me if the issue is fixed?

It requires the rust msvc toolchain ?

from martypc.

graphixillusion avatar graphixillusion commented on May 24, 2024

@dbalsom crash upon start:

Failed to parse configuration file. There may be a typo or otherwise invalid toml:
missing field composite for key machine at line 176 column 1

from martypc.

dbalsom avatar dbalsom commented on May 24, 2024

sorry, just add a line composite=false to the martypc.toml file under video="CGA"

that's from the new composite code in 0.1.3 :)

from martypc.

graphixillusion avatar graphixillusion commented on May 24, 2024

@dbalsom Yep now it works, but it still keeping US layout. Is it possible to add an option to set key to IT? By the way now the shift key works

from martypc.

dbalsom avatar dbalsom commented on May 24, 2024

can you check too that you can copy and paste to and from the breakpoint fields in CPU control?

from martypc.

graphixillusion avatar graphixillusion commented on May 24, 2024

can you check too that you can copy and paste to and from the breakpoint fields in CPU control?

yep, copy and paste works in breakpoint filed under cpu control

from martypc.

dbalsom avatar dbalsom commented on May 24, 2024

Just want to make sure nothing is remaining before I close this and work on putting out the new release. Everything good now?

from martypc.

graphixillusion avatar graphixillusion commented on May 24, 2024

For now seems so... Sorry for the little OT but i have searched around but still can't understand how to manually boot to the basic rom...

from martypc.

graphixillusion avatar graphixillusion commented on May 24, 2024

@dbalsom I don't know if this is a dos issue or it's some sort of bug but even if i set the keyboard to italian into the dos, some keys are wrong, for example if i press the esc key it does the esc function + print the \ char.
If i press the |\ key which is under the esc key in my layout, dos will print ù
<> key (which is next to the left shift) doesn't do anything
ù key ---> < char

from martypc.

dbalsom avatar dbalsom commented on May 24, 2024

there are some different options we could try with the KEYB utility... i wonder though could you send me a picture of your keyboard or link me to a picture online of a keyboard that matches your layout

from martypc.

graphixillusion avatar graphixillusion commented on May 24, 2024

@dbalsom here: https://i.postimg.cc/nhcPY2Pq/keyboard.jpg

from martypc.

dbalsom avatar dbalsom commented on May 24, 2024

now all i have to do is try to find a picture of an ancient 83 key italian keyboard... it's possible the layout has changed since the 80's. Obviously we added the euro symbol

when i added mappings from modern scancodes to XT scancodes I am afraid i was a bit US-centric; obviously i was only aware of the keys that I have on my keyboard, other layouts may have entirely new keys that generate different scancodes...

edit: the 'esc' issue happens on a US keyboard too. Whoops...

from martypc.

graphixillusion avatar graphixillusion commented on May 24, 2024

@dbalsom the layouts of the keyboards are in this manual i've found:

http://messui.polygonal-moogle.com/training/MSDOS_330.pdf

(page 325)

from martypc.

dbalsom avatar dbalsom commented on May 24, 2024

image

I think i see the problem. compared to the 80's IT layout we have a few problems: >< key had \ on it originally, but this was split off to two new keys, >< and |. Not sure why ESC would map to either... But in either case the >< has no equivalent on the US layout, so I don't have a scancode mapping for it. There's probably a lot of keys like this on different layouts, and I am not sure how I'd handle them all. Handling all these keyboards properly is going to be some work.

I think what might be necessary is that I have keyboard-translation files, and rely on contributors to help me make them. In next build i will have a debug_keyboard flag that will print all the scancode/keycode information to the console when you press a key. I'll get a test build up this weekend.

edit: on keys that have 3 symbols, how do you type the 3rd?

from martypc.

graphixillusion avatar graphixillusion commented on May 24, 2024

@dbalsom

  1. normal press = first char
  2. shift + key = second char
  3. altgr + key = third char

(altgr key == ctrl+alt)

from martypc.

dbalsom avatar dbalsom commented on May 24, 2024

hitting ctrl-alt-< on one hand on that 80's keyboard must have been uncomfortable. were you supposed to reach over with your right?

from martypc.

dbalsom avatar dbalsom commented on May 24, 2024

@graphixillusion can you run this program and hit that >< key and tell me what it reports
https://lateralus138.github.io/Key-ScanCode/

from martypc.

graphixillusion avatar graphixillusion commented on May 24, 2024

@dbalsom

KEY: <
SC: 056
VK: 0xE2

KEY: \
SC: 029
VK: 0xDC

from martypc.

dbalsom avatar dbalsom commented on May 24, 2024

Turns out that wasn't the original, original, italian IBM model F keyboard layout. The Model F was originally produced in French, German, Italian, Spanish, UK and of course, US layouts. Correspondingly, those will be my initial targets for translation files.

Here's the original Italian layout:
image

You can see the modern backslash key is actually the escape key here (by the way, hitting escape at the dos prompt does produce a backslash, even on a US keyboard on a real IBM 5150, not sure why I didn't notice that before)

I assume that is the backslash symbol lurking under the key face on the >< key, but I am at a loss for how you would generate a | character here, I don't see it anywhere.

Given the macro support I have, I could have the | character generate the requisite ALT+numpad ascii escape sequence, if necessary, but that may not work in all applications.

from martypc.

graphixillusion avatar graphixillusion commented on May 24, 2024

yep, infact the | key is the problem...

from martypc.

graphixillusion avatar graphixillusion commented on May 24, 2024

A little update: i've tried the version 0.2.0 and now almost all key works.

  1. The <> key which is between the left shift and the Z doesn't work.
  2. The ù key prints < and shift +ù prints >.
  3. \ key (under the esc and left to the 1) prints ù char
  4. left ctrl + left alt + ù prints the \
  5. the only way to do the | is to left alt + the sequence 1,2,4 on the numpad.

I saw the new keyboard_IT.toml config but i think this config is not reflecting the actual behaviour.

keycode_mappings = [
    # Map the '<>' key to IntlBackslash. 
    {keycode="IntlBackslash", modifiers=["any"], key_macro=[], macro_translate=false, scancodes=[0x2B]},      
    # Map the ù key to Backquote
    {keycode="Backslash", modifiers=["any"], key_macro=[], macro_translate=false, scancodes=[0x29]},   
    # Generate a backslash.
    {keycode="Backquote", modifiers=["any"], key_macro=["+ControlLeft", "+AltLeft", "+IntlBackslash", "-ControlLeft", "-AltLeft", "-IntlBackslash"], macro_translate=false, scancodes=[]},
    # Generate a pipe character. There is no equivalent on the italian model F.
    {keycode="Backquote", modifiers=["shift"], key_macro=["+AltLeft", "+Numpad1", "+Numpad2", "+Numpad4", "-AltLeft",  "-Numpad1", "-Numpad2", "-Numpad4"], macro_translate=false, scancodes=[]},      
]

from martypc.

dbalsom avatar dbalsom commented on May 24, 2024

i cannot reproduce. did you select keyboard_layout="IT" in martypc.toml and load KEYB IT,850 C:\DOS\KEYBOARD.SYS ?

from martypc.

graphixillusion avatar graphixillusion commented on May 24, 2024

During my first try i didn't set the it layout in the toml but inside the dos the keyb was already set to keyb it 850. Now i tried again with the toml setting and load that line in autoexec.bat but nothing changed

from martypc.

dbalsom avatar dbalsom commented on May 24, 2024

can you set this environment variable
RUST_LOG=debug,naga=error,wgpu_core=error,wgpu_hal=error

and then set the debug_keyboard=true value in martypc.toml ( under [emulator.input])

when you hit some keys it will print some debugs. can you try a few of the problem keys and share the output please?

from martypc.

graphixillusion avatar graphixillusion commented on May 24, 2024

Sure, here we are and sorry for late answer:

<> key:

KeyEvent { physical_key: Code(IntlBackslash), logical_key: Character("<"), text: Some("<"), location: Standard, state: Pressed, repeat: false, platform_specific: KeyEventExtra { text_with_all_modifers: Some("<"), key_without_modifiers: Character("<") } }
Window: WindowId(WindowId(199582)) Key pressed: IntlBackslash
[2024-04-04T23:12:47Z WARN  marty_core::devices::keyboard] key_down(): Got no scancode translation for key: IntlBackslash
KeyEvent { physical_key: Code(IntlBackslash), logical_key: Character("<"), text: None, location: Standard, state: Released, repeat: false, platform_specific: KeyEventExtra { text_with_all_modifers: None, key_without_modifiers: Character("<") } }
Window: WindowId(WindowId(199582)) Key released: IntlBackslash

\| key:

KeyEvent { physical_key: Code(Backquote), logical_key: Character("\\"), text: Some("\\"), location: Standard, state: Pressed, repeat: false, platform_specific: KeyEventExtra { text_with_all_modifers: Some("\\"), key_without_modifiers: Character("\\") } }
Window: WindowId(WindowId(199582)) Key pressed: Backquote
KeyEvent { physical_key: Code(Backquote), logical_key: Character("\\"), text: None, location: Standard, state: Released, repeat: false, platform_specific: KeyEventExtra { text_with_all_modifers: None, key_without_modifiers: Character("\\") } }
Window: WindowId(WindowId(199582)) Key released: Backquote

ù key:

KeyEvent { physical_key: Code(Backslash), logical_key: Character("ù"), text: Some("ù"), location: Standard, state: Pressed, repeat: false, platform_specific: KeyEventExtra { text_with_all_modifers: Some("ù"), key_without_modifiers: Character("ù") } }
Window: WindowId(WindowId(199582)) Key pressed: Backslash
KeyEvent { physical_key: Code(Backslash), logical_key: Character("ù"), text: None, location: Standard, state: Released, repeat: false, platform_specific: KeyEventExtra { text_with_all_modifers: None, key_without_modifiers: Character("ù") } }
Window: WindowId(WindowId(199582)) Key released: Backslash

from martypc.

graphixillusion avatar graphixillusion commented on May 24, 2024

I confirm, with this line everything works! Thank you very much for the super support!

from martypc.

Related Issues (20)

Recommend Projects

  • React photo React

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

  • Vue.js photo Vue.js

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

  • Typescript photo Typescript

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

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

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

Recommend Topics

  • javascript

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

  • web

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

  • server

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

  • Machine learning

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

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

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

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.