[Release] Vice3DS (C64 Emulator)

Discussion in '3DS - Homebrew Development and Emulators' started by Badda, Mar 31, 2019.

  1. Badda
    OP

    Badda GBAtemp Regular

    Member
    5
    Feb 26, 2016
    Tokelau
    Nirvana
    Ok, glad to hear that. I spotted and fixed the bug with the stretch screen for the next version already.
     
  2. Elwyndas

    Elwyndas GBAtemp Regular

    Member
    4
    Dec 19, 2018
    United States
    Badda it looks like you are working on a major release, which is great. Thank you for that.
    There is something in terms of usability that is subtle but annoying. It's probably difficult to catch on Citra, if you don't verify and test every aspect on the physical 3DS, which has buttons but no mouse.
    The navigation is not consistent. This is probably due to the VICE heritage, which is not the same as what 3DS users are used to. To give you an example, if you navigate the directory of the SD card, pressing B will get you back to the main menu. If you want to go up in the directory, your have to move the marker to the [..] entry and press A. On 3DS, nobody ever presses A to go back. It's not a big deal really, it's just not consistent with the rest of the navigation, where B will always get you "back". I recommend to adapt the navigation of the FBI homebrew app, navigating the SD card contents.
     
    Last edited by Elwyndas, Nov 15, 2019
  3. Elwyndas

    Elwyndas GBAtemp Regular

    Member
    4
    Dec 19, 2018
    United States
    BUG:
    Something is wrong with both "joysticks"
    Run this cartridge:
    https://csdb.dk/release/?id=107355
    When you select the monsters, more than half of the time, the directional input is not registered. It feels like there is a hardware problem with the buttons, but there isn't. The directional input works fine in the navigation.
    I have also noticed this issue in the Ultima IV Remastered CRT release. That release allowed joystick input for directions. I always blamed the problem on that otherwise brilliant release, but now I'm thinking that this is a peculiar issue of Vice3ds? It also happens with the D64 version.
    https://csdb.dk/release/?id=138772

    Weird.
     
    Last edited by Elwyndas, Nov 15, 2019
  4. Badda
    OP

    Badda GBAtemp Regular

    Member
    5
    Feb 26, 2016
    Tokelau
    Nirvana
    That was actually already bothering me as well - will be changed in next version

    — Posts automatically merged - Please don't double post! —

    The joystick handling is the same no matter which game is running in the emulated C64. If one game works well (and there are a lot) and the other does not, this should be the fault of the game programming. How does it work on actual C64 hardware? Or at least in WinVICE? Can you reproduce the issue there? I actually did not change anything in the joystick handling of VICE when porting to 3DS.
     
    Last edited by Badda, Nov 16, 2019
  5. Elwyndas

    Elwyndas GBAtemp Regular

    Member
    4
    Dec 19, 2018
    United States
    My physical Commodore 64 is residing on my desk, but that desk is on the other side of the ocean.
    I actually have a real C64 where I live, but that piece has a broken chip! However I will look into this further. But for anybody out there who can run code on the real machine for testing, please do and report back if you notice discrepancies. The goal is to have the #1 C64 emulator, and it being on 3DS. It already is but the position needs to be cemented.
     
  6. Badda
    OP

    Badda GBAtemp Regular

    Member
    5
    Feb 26, 2016
    Tokelau
    Nirvana
    Here comes release candidate 3. LOTS of bugs have been fixed and some small enhancements and optimations were included. Most - if not all - your comments should be addressed.
    Changes to RC2 are:
    • enhancement: vice3DS checks for autostart.*-files in romfs:/ and vice directory and autostarts at startup
    • enhancement: autofire can now be configured in the joystick keysets
    • enhancement: support of zip files for autostart
    • optimization: cancel-key moves one directory up in file dialog
    • lots of other bugfixes and small enhancements
    https://github.com/badda71/vice3ds/releases

    Have fun and again happy testing!
     
    arquillos, Cid2mizard, AMJ and 7 others like this.
  7. troutbelly

    troutbelly Newbie

    Newcomer
    1
    Jun 20, 2007
    United States
    Just found this and loving it! What took me so long?

    RC3 crashes every time I close my n3ds; it doesn't seem to handle sleep well. I rolled back to RC2 for that reason.
     
  8. Elwyndas

    Elwyndas GBAtemp Regular

    Member
    4
    Dec 19, 2018
    United States
    Confirming the crash on closing the lid. You can't even start Rosalina after that, and need to perma-press the power button to get out of it. Besides that I have noticed countless bugfixes and many small improvements. There is not much left to make this product 101%. Working on that list.

    If you want to contribute it's probably best to work with the latest version and report back.
     
    Last edited by Elwyndas, Nov 19, 2019
  9. Badda
    OP

    Badda GBAtemp Regular

    Member
    5
    Feb 26, 2016
    Tokelau
    Nirvana
    This is possible from v2.RC3 on. You need to unpack the CIA, include an autostart-file in romfs, optionally adapt the icon & banner and repack the CIA. Here is a short guide how to do this:
    You need the following tools avaiable in your $PATH:
    You also need:
    • the original vice3DS-C64.cia file (v2.RC3 or later)
    • a D64, T64, VSF or CRT file that should get autostarted
    • optionally, a new icon (48x48px PNG-file)
    • optionally, files for a new banner (256x128px PNG-file & WAV-audio max 3 seconds)
    • anything else you want to change in the romfs (e.g. a new sdl-vicerc file)
    Put all these files in a temporary directory with the following names:
    autostart.*, banner.png, banner.wav, icon.png, vice3DS-C64.cia, ...
    upload_2019-11-19_11-17-40.png
    Open a shell, change to the previously created directory and execute the following commands:
    Code:
    # Unpack CIA
    # ==========
    ctrtool --contents=contents vice3DS-C64.cia
    mv contents.0000.* contents0.bin
    3dstool -xvtf cxi contents0.bin --header HeaderNCCH0.bin --exh ExHeader.bin --exh-auto-key --exefs ExeFS.bin --exefs-auto-key --exefs-top-auto-key --romfs RomFS.bin --romfs-auto-key
    ctrtool --logo=LogoLZ.bin --plainrgn=PlainRGN.bin contents0.bin
    3dstool -xvtfu exefs ExeFS.bin --header HeaderExeFS.bin --exefs-dir ExtractedExeFS
    3dstool -xvtf romfs RomFS.bin --romfs-dir ExtractedRomFS
    
    # Insert custom banner
    # ====================
    bannertool makebanner -i banner.png -a banner.wav -o ExtractedExeFS/banner.bnr
    
    # Insert custom icon
    # ==================
    bannertool makesmdh -s "vice3DS-C64" -l "vice3DS-C64 - Vice C64 emulator for Nintendo 3DS" -p "badda71 <[email protected]>" -i icon.png -o ExtractedExeFS/icon.icn
    
    # Copy autostart/sdl-vicerc
    # =========================
    cp autostart.* ExtractedRomFS/
    cp sdl-vicerc ExtractedRomFS/config/
    
    # Repack CIA
    # ==========
    3dstool -cvtfz exefs CustomExeFS.bin --header HeaderExeFS.bin --exefs-dir ExtractedExeFS
    3dstool -cvtf romfs CustomRomFS.bin --romfs-dir ExtractedRomFS
    3dstool -cvtf cxi CustomPartition0.bin --header HeaderNCCH0.bin --exh ExHeader.bin --exh-auto-key --exefs CustomExeFS.bin --exefs-auto-key --exefs-top-auto-key --romfs CustomRomFS.bin --romfs-auto-key --logo LogoLZ.bin --plain PlainRGN.bin
    makerom -target t -rand -ignoresign -f cia -content CustomPartition0.bin:0:0x00 -o vice3DS-autostart.cia
    The new CIA is called "vice3DS-autostart.cia", all the other files can now be deleted.

    Maybe someone can take this procedure and wrap it into a nice UI or webpage :D
     
  10. Elwyndas

    Elwyndas GBAtemp Regular

    Member
    4
    Dec 19, 2018
    United States
    Cool!

    Does this sdl-vicerc file contain the complete settings of the emulator, for example any custom key mappings? For example I would create a highly customized soft button layout just for Ultima IV Remastered.
     
  11. Badda
    OP

    Badda GBAtemp Regular

    Member
    5
    Feb 26, 2016
    Tokelau
    Nirvana
    Yes, sdl-vicerc contains all key mappings and hotkeys. You can edit the ui the way you want, save your settings and include the saved sdl-vicerc file into the romfs. If you want, you could even include your own soft button icons - they're all in the config-folder in romfs with the name ICON_*.png
     
    Last edited by Badda, Nov 19, 2019
  12. Elwyndas

    Elwyndas GBAtemp Regular

    Member
    4
    Dec 19, 2018
    United States
    In those shell commands, it looks like mv and cp are meant for linux.
    Anyway, I got it to work and created an Ultima IV cia! The banner.wav plays wrong audio. It's probably because some setting on the wav file I have is not right.
    Also, when installing it, it takes over the title position of Vice 3DS and overwrites it.
    It plays, and all the settings are in place! This is really neat. The little piece I made is now the best portable way of playing Ultima IV. I loaded the crt version of Ultima IV Remastered, assigned the most common commands like attack, cast, enter, talk etc to various buttons, assigned the original C64 keys for moving the character to the D-Pad, moved the soft buttons that matter to the top half of the bottom screen, increased the speed a little bit, removed joystick ports, skipped the cracker intro and then saved the state, amateurishly created a banner and icon, and voila, this is now more convenient and fun to play than anywhere else I have ever played, including the real deal, and it fits in my pocket :)

    I attached the sdl-vicerc settings file in case anyone wants to use it to improve the Ultima IV experience. It can be used in the regularly installed Vice 3DS as well. Which keys have been assigned to what can be found out by pulling up the help screen (top right corner bottom screen).

    Only real problem so far is that saving the game doesn't work (not talking about save state of the emulator here). It does alter the crt file I loaded when I press Q for Quit and Save - I know because when I do a reset I can load the saved game. However when I quit the emulator and restart it, the old saved game is gone, and it's the same as originally on the crt I used to create the cia. Long story short, ideally there is a way to maintain changes to the autostart file when exiting the emulator.
     

    Attached Files:

    Last edited by Elwyndas, Nov 20, 2019
    Badda likes this.
  13. Elwyndas

    Elwyndas GBAtemp Regular

    Member
    4
    Dec 19, 2018
    United States
    Some small things I have encountered while messing around with RC3:

    Speed settings:
    • There should be smaller increments in the presets, especially for increasing the speed. Most of the time I increase the speed only a little bit, like 110% or 120% and not 200%. With just a small increase, many games become significantly more enjoyable than the original, and the music doesn't change much of its pitch and bpm either.
    • Same is true for the (3D) slider. The first jump is too high, 130% or so. 110% would be better.
    • The refresh rate should be 1:1. On New 3DS there shouldn't be any performance issues anymore, and the only way to find out is if everybody has 1:1 by default and therefore notices distortions. I found only one small problem in a very demanding demo.

    Navigating the file system:
    • When going beyond top or bottom, the marker should jump to the top (or down), like it does in the settings menu

    Autostart image:
    • I mentioned this before and I bring it up again because it's just such an inconvenient thing. When selecting to autostart a disc, you don't want to have to select a file from the directory. In fact, it's not always clear which file to pick. Then you get errors, which will frustrate the C64 curious. Ideally, autostart executes Load"*",8,1:Run on regular discs
    • When a d81 or other unusual image is loaded, it should actually detect the format and automatically activate the appropriate drive for that image. Otherwise it throws an error, because you are attempting to load a 1581 disc inside the default 1541 (yikes! Don't try that at home!). Cartridge image handling is excellent. In fact you have to wonder why they didn't put the complex games on cartridges to kill those heinous disc loading times.

    Snapshot:
    • I have noticed it a couple of times that by saving a snapshot, some of the soft button icons get corrupted. It's not causing errors, it just doesn't look nice.

    Saving settings:
    • I have not figured out how to actually create a new file, with a new name. All I can do is overwrite an existing file. This doesn't make much sense, unless I have simply not found out how it's done.

    Sound settings:
    • Does 48khz actually do anything better than 44khz default? Maybe I'm just too old to hear it, or one has to connect this to an amplified system.

    Commands (in misc. settings):
    • As far as I know, there is no backslash key on the CBM keyboard. Here it is necessary though to execute "Enter". Because of this I have not been able to execute commands automatically that I put in there. I always have to press Enter manually. Edit: For some reason, pessing the British pound sign gets me the backslash.
     
    Last edited by Elwyndas, Nov 20, 2019
  14. Elwyndas

    Elwyndas GBAtemp Regular

    Member
    4
    Dec 19, 2018
    United States
    I'm looking at the "Type Commands" function. This could be utilized to greatly improve playability of text heavy adventure games where you have to type certain words over and over again, like look, search etc.
    I would put those words into the list, and then allow smaller hot keys to be created and populate the bottom screen. Perhaps it's possible to add a 2nd design where text based hot keys are just one liners with some space around them.
     
  15. Badda
    OP

    Badda GBAtemp Regular

    Member
    5
    Feb 26, 2016
    Tokelau
    Nirvana
    Thanks for all the feedback and the suggestions. Right now, I'm still trying to fix the crash when closing the lid which is a tough nut to crack.
    Moving the menu to the bottom screen and into a new thread really got me into a lot of trouble with race conditions :hateit:

    The 2nd design would be a low priority for me. I don't think, playing text adventures on the 3ds really makes sense - nobody is playing this anymore on computers with real keyboards - why on 3ds?

    As with regards to your other topics:
    When autostarting an image from romfs, the image can not be modified (romfs = read only memory file system). No idea how this could be changed though - I would have to use 3DS savedata slots, but no idea how.

    Speed settings: 1:1 refresh rate is IMHO not optimal. Normally the emu tries to achieve 1:1 refresh rate anyways - only when the emulation running is very demanding, the framerate drops. This way, you will get frameskips but rarely sound buffer underruns (which you will definitely get when using 1:1 refresh rate).

    Navigating the file system: You know that you can use d-pad left/right for pgup/pgdn. Apart from this, you can drag the scrollbar with the stylus for very fast navigation

    Saving settings to a new file: Use Settings management -> Save current settings to -> (enter filename)

    Commands: \ comes when you type £ (hidden feature :D)

    I believe the Emu is almost finished now. However, what I would really like to do after the 2.RCx bugs are fixed and 2.0 is out, is a gamebase64 integration where you can browse the game library, download games and play directly with vice3DS. gamebase64 is better for this than CSDb because you can download the whole database (without screenshots and disk images) in one file which is ideal for my purpose.

    Well, first off I need to get that damn bug fixed.
    Home button does not work either - but those two bugs are actually connected...
    And .. whats really strange: If you press the (non-working) home button before closing the lid, the 3ds will not crash ... :wtf:
     
    Last edited by Badda, Nov 20, 2019
  16. Elwyndas

    Elwyndas GBAtemp Regular

    Member
    4
    Dec 19, 2018
    United States
    As you know, my goal with your product is to improve it to the point where it's the only method people want to use when it comes to the C64 - real or emulated :)
    The buttons and the lower screen have endless possibilities, and can be used to make games that have become challenging or out of fashion interesting to play again, or even playable for the first time. Ultima V for example is unplayable. I will create a playable version one day, and it will only work on your software. By customizing the inputs for Ultima IV I realized that this game all of a sudden is much faster in game play. There is no way I would ever go back to the real thing. The idea is to create forwarder CIA's where these changes are built in for other games as well where this makes sense, and all of a sudden you have something lots of people will want to install.

    A great hacker in Germany is right now working on creating a fast loading crt version of The Pawn, a command driven adventure game with lots of great pixel art. Without a preset of commands and speed slider I would probably never even bother looking at it again. But so... your work keeps culture and art alive.

    Just look at Elite. The controls on the C64 were all based on keyboards. Unintuitive. On the 3DS with custom inputs all of a sudden it will shine like a newborn.
    https://www.c64-wiki.com/wiki/Elite
    I had thought about gamebase64 too, especially because they just came out with a new version, amazingly. I tried to install it on my Windows machine the other day but got an error. But yeah, a "USB Loader" style interface that could do this would be awesome. The size of all games looks like to be a little over 10 GB compressed, so it could be made available offline as well.
     
    Last edited by Elwyndas, Nov 20, 2019
  17. Elwyndas

    Elwyndas GBAtemp Regular

    Member
    4
    Dec 19, 2018
    United States
    I managed to adapt the screen buttons and keys to work with Elite. At first I thought this would never work, but this game, which is very keyboard intensive, and cannot really be played with a joystick even though it's supported, all of a sudden becomes a breeze.
    Anybody who has played this game, and who hasn't, remembers the weird controls. The joystick option is terrible for one reason, that you need a free hand to control speed through the keyboard. But most people use the joystick with both hands.
    The controls through the keyboard are sub-par, but you get used to it.
    Now on Vice 3DS you actually use the joystick option, and designate the round D-Pad for that, and A for fire, and Y/B is used for speed control. Whoa! So much better than on the original!
    Unfortunately I discovered a problem. It doesn't seem to be possible to press the simulated joystick in a direction, and at the same time also register a keyboard input. For example if you want to go UP with the Joystick (C-Pad) and decrease or increase speed at the same time by pressing the corresponding keys, which is a crucial maneuver in Elite space fights, it doesn't work. You need to release the key pressed first for the other one to work. The workaround is to switch off joystick support in Elite, and assign the directional keys s,x etc to the C-Pad. Then it works. However, I discovered that true joystick support is actually much easier to use. So this is a problem. Perhaps a Vice bug?

    The soft buttons I assign to numbers, so buying/selling works, and some more soft buttons to functions like F1 to exit space stations and others. The D-Pad is assigned to Short Jump, Hyper Jump, Activating and Deactivating Missile. The X button is launching missiles. The left shoulder keys are for docking computer on/off, and the right shoulder keys are for exiting trade menu and pressing enter.
    It's kind of crazy to see C64 Elite work better on the 3DS than on any other platform I can imagine, including the original. Being able to speed up the machine is gravy.
     
    Badda, SmashinGit and Vulpes-Vulpeos like this.
  18. Badda
    OP

    Badda GBAtemp Regular

    Member
    5
    Feb 26, 2016
    Tokelau
    Nirvana
    Sounds really good :-) Would love to try this out ...
    Regarding the issue with the joystick, could you post your sdl-vicerc file and a link to the D64 file so I can reporoduce the issue?
     
    SmashinGit likes this.
  19. Elwyndas

    Elwyndas GBAtemp Regular

    Member
    4
    Dec 19, 2018
    United States
    Some more observations:
    • The C= key cannot be mapped. It just alternates the keyboard. This is an issue because a lot of games utilize that key for something actionable.
    • I would love to abuse the home, start and select button for mapping. Home can't be selected, but start and select can. However this will confuse the hell out of some people. Also, when start is mapped to something that's not start, the rearrangement of soft buttons can't be saved. The select button function can also be found on the top left of the lower screen so this is tolerable, and the start button function to exit the emulator can also be found in the main menu. Is the home button blocked for good or can you release it? I know this totally messes with basic 3DS layout but I'm hoarding every piece of real estate that's available for customization of games, for future mass releases of CIA's :). I would probably remap the volume slider if I could, or even the hinge movement. Hell, I would remap my grandmother if this helps usability.
    • CTRL removes all letters from the keyboard, so I can't press combos. In Elite you must press CTRL+H for a galactic hyperjump
    • New keystrokes like run/stop+restore cannot be defined, and cannot be mapped. Just like in Elite, there are plenty of games where this is desirable. Similar to being able to map pre-defined commands.
    • It looks like speed settings are excempt from being included in the snapshot save.
    • The little real estate where the version number is bottom left could be mapped to trigger the keyboard hiding. Text can just stay as is.
    Will post Elite settings shortly.
     
    Badda and SmashinGit like this.
  20. Elwyndas

    Elwyndas GBAtemp Regular

    Member
    4
    Dec 19, 2018
    United States
    I found out that the joystick problem is actually a bug in the game.
    There have been attempts to fix it, for example in Elite 128.
    There are also other attempts to improve the game, for example fixing the flickering.
    I found at least one ongoing project.
    I'm doing more research to find the best version.
    Meanwhile the version I have been working with is
    https://csdb.dk/release/?id=60260
    I attached the snapshot file and settings file.
    I'm confused that the English version doesn't fancy a docking computer?

    The cursor stick gets the Function keys assigned, so you can easily switch between window views. Another huge advantage of the N3DS over the original machine :)
    The left shoulder keys point to Yes and No.
    The right shoulder keys point to Inventory and Return
    And so on. I think the mapping is pretty much perfect now, except that the game is buggy, and that I can't press CTRL + H
     

    Attached Files:

Quick Reply
Draft saved Draft deleted
Loading...