|
Post by jj0 on Sept 26, 2020 13:59:59 GMT
Maybe change the title now to "Gurce's C64Emu PCU Mod".. just a idea.. Hmm... Technically that would not be correct as the changed ..rgl file works just as well if copied to the NAND
|
|
|
Post by spannernick on Sept 26, 2020 15:24:29 GMT
Ok, my first post will be the TL;DR version: Was dabbling with the idea of 4-player support over last night and tonight. It's working ok-ish, with a few important caveats: - If you plug in a joystick into the rear USB port, the help menu freezes again. It seems to prevent my new keycode scanning logic from working, something else seems to consume such events and my routine doesn't get them So if you want to try this experimental build, avoid plugging a joystick into the rear port and stick with the side ports or put your joysticks on a usb-hub.
- For any 4-player game you want to try, you will need to create a .cjm file for it to assure that joystick 3 and 4 have some default joystick mappings. E.g.:
X:64,pal J:1*:JU,JD,JL,JR,JF,JF,RS,SP,SP,RS,F1,F7,RS J:2:JU,JD,JL,JR,JF,JF,RS,CM,SP,F1,F3,F5,RS J:3:JU,JD,JL,JR,JF,JF,RS,CM,SP,F1,F3,F5,RS J:4:JU,JD,JL,JR,JF,JF,RS,CM,SP,F1,F3,F5,RS
- If you plug in 4 joysticks, on initial powerup, you only seem to be able to use the first 3 joysticks to control the carousel (and also the keyboard). If you then boot to the PCU carousel, it seems to then register all 4 joysticks on the carousel, but you no longer have the keyboard input working (don't know why as yet). So none of my keyboard shortcuts work, including my CTRL-U shortcut to toggle the userport 'ExtraJoy' setting on/off. So to get around this problem, for this build, I've just turned this userport 'ExtraJoy' setting on by default, as I assume anyone that wants to have a play with this build just wants to try out 4-player games. To get the keyboard to work again, you could unplug one joystick (and then my keyboard shorcuts all come back), but alas, if you re-plug in the joystick, it won't re-register, so you'll be stuck with 3-joysticks and 1-keyboard
I'm hesitant to push this technique into the pcu-branch, as it still feels kinda experimental, and I don't like the idea of leaving that 'ExtraJoy' setting on by default, as I suspect it might adversely affect other programs/games that aren't expecting that user-port joystick adapter being attached. You can grab the .rgl file from here. I have added the last c64emu with warp mode now to PCU and added the c64emu-4joy.rgl too but it not enabled by default. #------------------------------------------------------------------------------------------------------------------------- # VICE Emulators - C64.. #------------------------------------------------------------------------------------------------------------------------- # Swap Joystick Ports - C64 Emulator With option to change Joystick Ports(Port 1 or Port 2 on the fly as C64 Emulator is # running) using CTRL+Left Arrow, Thanks goes to Gurce for this. #------------------------------------------------------------------------------------------------------------------------- #------------------------------------------------------------------------------------------- mount --bind /mnt/Carousel_Games/Options/emulators/c64emu-pcu.rgl /usr/lib/c64emu.rgl #------------------------------------------------------------------------------------------- # VICE Emulators - C64 - 4 port mode.. #------------------------------------------------------------------------------------------------------------------------------------ #------------------------------------------------------------------------------------------- #mount --bind /mnt/Carousel_Games/Options/emulators/c64emu-4joy.rgl /usr/lib/c64emu.rgl #------------------------------------------------------------------------------------------- if you enable 4 port mode then it will mount over the top of swap joysticks ports but it include with it anyway..
|
|
|
Post by armalyte on Sept 26, 2020 16:38:19 GMT
gurce i am loving these mods you are doing. great work!. if you could add a sid filters on/off to the options it would be awesome.
|
|
|
Post by gurce on Sept 27, 2020 0:53:22 GMT
@spannernick: Ah ok, I get your drift regarding wanting to add the emulator mods into the compilation of carousel v1.05. I've never tried building v1.05 yet, so I can't say for sure, but maybe it might be possible by copying all my modifications across into the vice2 sub-folder of v1.05. You should be able to grab the source via the github repo, either via git, or even without git (pick the pcu branch, and I think the web-page offers some "download as zip" option somewhere). I think I also tweaked one or two things inside redquark (within the viceport and vbuild folders, I think), but maybe they aren't as critical. Hehe as for renaming the mod with my name in it, no worries, happy for my name to remain in the shadows and for it to be snuggled inside the wider pcu umbrella. Besides, I think/hope other coders might eventually want to contribute their own mods into the mix one day, so want to leave the door open a little for them ;-) armalyte okidoke, will aim to add a sid-filter toggle in my next window, sounds like it won't be too stressful. More stressful will be getting my keyboard woes sorted, Jj tipped me off on the evtest tool, so I'll be studying the source of that to get some ideas on how to confirm the path of the keyboard input device. Maybe a wilder idea on my wishlist would be adding a shortcut key to let you jump into a bash shell (while emu gets paused and the shell window gets drawn courtesy of redquark+vice's drawing mechanism). Might be a tricky one, but thought it'd be cute/fun to be able to jump into a shell, quickly rename any games with extra file-extensions, or even sniff around other parts of the system... Anyways, a dream for another time... :-)
|
|
|
Post by gurce on Sept 30, 2020 15:26:52 GMT
One thing I was wondering, jj0, you mentioned that FEL-mode is available via thec64 maxi's back USB-OTG port. I was wondering what kind of usb-cable would I need to hook it up to my laptop and see some output in a terminal program?
I had a read online of this page:
It talked of bridged cables, A/A cables, A/B cables, and how the wrong cable could burn your usb port, and the description between them all seemed a little jumbled, so wasn't sure which way to go.
|
|
|
Post by spannernick on Sept 30, 2020 23:30:08 GMT
|
|
|
Post by jj0 on Oct 1, 2020 5:43:26 GMT
For FEL mode access you need a USB Type A male to Type A male cable for the Maxi. For the Mini it's a USB Tyoe A male (PC side) to Type Micro B (Mini side). FEL mode is to load programs into the Mini/Maxi's memory and execute them. Amongst others to flash the internal NAND. But to get outout from the serial console to see what's happening you need to connect to the UART connector holes. For this you need a serial2usb converter and maybe an USB extension cable. See thec64community.online/thread/79/adding-uart-connector
|
|
|
Post by gurce on Oct 1, 2020 5:52:49 GMT
Aah right, thx for the info guys. So it feels like I've mixed up the concept of FEL mode with having serial terminal access.
I guess I just recalled these two topics being intertwined back when I did the uart-mod for the c64mini a few years back.
|
|
|
Post by spannernick on Oct 1, 2020 19:17:16 GMT
You can't remember everything, I get confused about things all the time..
|
|
|
Post by gurce on Oct 2, 2020 16:06:20 GMT
Have been chipping away at the bash-terminal idea for the past few nights, lots of failed efforts and hurdles, but in incremental progress.
Did a lot of googling to learn how linux spawns child processes. Learnt that there were many ways, and I tried many of them. system(), popen(), fork() and they were all failing for me. They were getting errno=12 (ENOMEM / Out of memory).
Then some more googling got me this interesting read, that educated me on how fork() often fails this way for embedded systems with limited memory.
There was a suggestion to use posix_spawn(), which also failed with ENOMEM for me, but the man page for it mentioned setting a POSIX_SPAWN_USEVFORK attribute might help, and it did.
I tried using posix_spawn() to run a hardcoded "/bin/mount" command, and I pumped all the output onto the emulator's screen. This worked! Was happy about that.
So then I tried hard-coding it to spawn "/bin/sh", but the child-process just exited straight away.
So then I tried spawning it via busybox. "/bin/busybox sh", this just stalled the emulator, but I suspected it was waiting for input.
So on my next attempt, I wrote to the child's stdin pipe this:
write(cin_pipe[1], "ls /\n", 6);
Running this on the device, it then outputted the following on the emulator screen:
bin dev etc init lib lost+found media mnt opt proc root run sbin sys tmp usr var
Aah nice, pretty happy about that But then I noticed that the child process exited immediately after (I was hoping it'd stay).
Writing these notes now helped me reflect on things, I'm starting to suspect my write() line shouldn't have included the null-terminator:
write(cin_pipe[1], "ls /\n", 5);
Ah well, too late to try it tonight, will try again tomorrow.
Another hurdle will be converting the key scancodes into ascii letters, but I'll save that journey for another day...
|
|
|
Post by gurce on Oct 16, 2020 10:33:47 GMT
I've been a little quiet on this as I've been trying to read up on how to make this bash-shortcut to work, and it has been proving hard, maybe it's beyond me for now.
In a way, maybe it's not so critical, as JJ's XWM is readily available within PCU and people's bash needs can be accomodated from there. I just thought it'd be nice/cute if it was also readily available within the emulator via a shortcut too, ah well
I'll share some of my studies, in-case one day I want to give it another try, or maybe others might.
- So to recap, using fork() didn't work, as it gave me that ENOMEM error (out of memory).
- Using vfork() via posix_spawn() looked promising, but it always bails out after the first command completes
- I tried to comprehend why vfork() was failing on me. The best hint I could find was in "man vfork"
Sure, it all felt very educational, but it was brain overload for me, so might have to back off from this idea, and maybe try it another time, if I've got the appetite for it.
If I were to brave it again, maybe another way to go about it might be to spawn a new bash terminal within Nick's "autostart.sh" script, redirecting its input and output to named pipes, and then try read from and write to those pipes.
I gave this idea a try tonight in my macbook's console with: - In Terminal 1:
mkfifo pcuin mkfifo pcuout
- In Terminal 2:
cat pcuout
- In Terminal 3:
cat > pcuin - Back in Terminal 1:
bash < pcuin &> pcuout
Ok, now I can type input commands within Terminal 3 (e.g., "ls", "pwd", "uname -a") and I'll see the output of these commands in Terminal 2.
Though one thing that Terminal 2 misses is showing the bash prompt and echoing the characters I type one-by-one.
From what I read relating to tty, I kinda feel this has something to do with tty's canonical-mode versus raw-mode.
So I thought typing in a command like "stty raw" might help, but this got me the error:
stty: stdin isn't a terminal
Anyways, it might be fun pursuing this idea one day, but feel like I've run out of steam on this attempt, so might back off on it
|
|
|
Post by spannernick on Oct 16, 2020 10:53:46 GMT
Oh well, you tried that all you can do..
|
|
|
Post by MeneerJansen on Oct 21, 2020 14:31:59 GMT
gurce: Thank you for making this alternative for the emulator that came with THEC64. I can't do without it anymore. I can finally use all those system cartridges and swapping joysticks is easy now.
|
|
|
Post by gurce on Oct 22, 2020 18:38:45 GMT
No probs, glad it was useful :-)
|
|
|
Post by spannernick on Nov 1, 2020 23:23:25 GMT
I was testing the Carousel v1.4.1 from THE VIC 20 and I put it into PCU and it would only show the logo and then stop(no Carousel would not come up), I just found out that it was the C64emu-pcu.rgl file that was causing it, the Carousel might be checking the C64emu.rgl file so finds its not the right size and stopping the Carousel, but it just a guess, works fine in v1.3.2, very weird.
|
|
|
Post by gurce on Nov 1, 2020 23:35:18 GMT
Hmm, not sure whats up there. Perhaps I need to apply my changes ontop of the newer firmware. Not sure if RGL has updated their repo with this latest firmware. If they have, we could try that.
|
|
|
Post by spannernick on Nov 2, 2020 22:07:48 GMT
RGL have added buttons in 1.4.1 in Media Access for Tape images, buttons are.. Rewind, FF, Play and Stop and a tape counter, properly so you can control where the tape is and if you have a image thats a tape compilation, I like the idea of the tape counter so you know what number the game loads to.. They probably put new code in the c64emu.rgl and vic20emu.rgl for them.
|
|
|
Post by spannernick on Nov 5, 2020 19:52:33 GMT
Oh and C64emu-pcu.rgl is v1.3.0 ..
|
|