Gens4All with Z80 Emulation

Place for discussing homebrew games, development, new releases and emulation.

Moderators: pcwzrd13, deluxux, VasiliyRS

BLEEN
shadow
Posts: 5

Re: Gens4All with Z80 Emulation

Post#201 » Tue Jun 07, 2022 10:10 pm

TapamN wrote:
BLEEN wrote:Hi, TapamN! I really appreciate the hard work you've managed to pull off with this release! It works extremely well! I just have one question. Is it possible for you to release a version of this that supports the correct aspect ratio/resolution in 240p thru S-video? A lot of users still use the Dreamcast on CRTs and the Genesis in an emulated 240p state would look amazing! I'm sure everyone who still uses S-video (and RGB and composite) would be super grateful! The Dreamcast on a CRT looks so, so good already! Genesis @ proper 240p would be the icing on the cake! Most, nearly all, CRTs don't have a VGA port and S-video is pretty close to RGB quality-wise and much better than composite.

I've read thru multiple threads and tried multiple releases but pretty much enabling/disabling 'Interlace' mode has no effect. The graphics, while they do look great, you can tell there's a blur because something is not displaying the resolution correctly? Would that be an easy fix?

Or is it possible I can compile this to display correctly myself? I just wouldn't know where to start. Thanks once again!

Yeah, I wasn't able to test the 240p mode myself. I looked at the source for the 240p Test Suite, tried to adapt it to Gens4All, and just hoped that I did it right. I normally use a VGA CRT, next to my computer and Dreamcast, that I use to test things with. I have a small 480p LCD TV that I could use to test things with, but that wouldn't be good for testing 240p. I also have a CRT TV from around 1999 or 2000, but that's in another room and it's too big to move to where I keep my computer, so it's very inconvenient to test with. I'll try taking another look at it, but I don't know when.

Getting the aspect ratio correct for 256x224 is tricky. The Dreamcast doesn't really support resolutions other than 640 or 320 wide. (You can kind of fake some of them by doing things by adjusting the overscan or sync signal widths, but that's not well supported by all displays.) The best option for getting aspect correct 256 wide resolution on the DC would be to basically render to a point sampled 512 wide texture, then do a bilinear upscale to 640. This would avoid a lot of the blur from a 256->640 direct bilinear upscale, and limit the shimmering from uneven pixel widths from drawing stretched point sampled to 640.

The vanilla KOS PVR driver isn't capable of doing that; it's render-to-texture is way to basic pull it off at full speed (it only supports rendering to framebuffer sized textures, and that would be too slow). I've written my own driver with better render-to-texture support, but I'd have to convert Gens4All over to using that. The rendering code wouldn't need any major changes, just the initialization and mode/resolution switching. Maybe I'll try working on it at some point, but I've been focusing on other things right now.

Compiling Gens4All from scratch is a bit more tricky than normal KOS programs. Not only do you need a KOS environment, you need DCSDL and the development libraries for GLib installed. When Gens was originally ported by Chui, he used GLib for part of the compilation process (GLib isn't used on the DC itself). The 68K emulator is written in assembly, but not by hand. A C program (or maybe it was C++?) is used to generate the SH-4 assembly for the 68K emulator, and that uses GLib for... something. I don't remember what for.

If you're using Linux or Cygwin, it's easy to install the GLib dev libraries through whatever package manager you use. If you're on another system, I don't know how you'd install it. But if you already have a KOS dev environment, I could upload the object files. Then you wouldn't need to compile the 68K core from scratch and could avoid the GLib dependency, as long as you don't "make clean".


Thank you for the in-depth response! I'll research what I can but I'm certain most of what's needed to be done will go right over my head lol

I do appreciate you getting back to me and letting me know the nitty gritties. Cheers!

MoeFoh wrote:
BLEEN wrote:
TapamN wrote:After seeing some of what was going on in the Gens4Dreams thread, I ended up making another small update. Here are the changes:
  • Non-interlaced 240p mode added. I think that on NTSC, ideally, the Dreamcast's interlace mode would match the Genesis's (with an option to force interlaced for displays that don't handle non-interlaced well), but that's more work than I want to do now. I looked at what the 240p Test Suite did when setting the video mode, and tried to replicate it. I haven't actually tested this out on a real TV, so it's off by default. To enable 240p, press Y on the title screen before pressing Start. Interlacing is still enabled in the loader.
  • Button map display. Press Y on the controls menu to show the button mappings for the highlighted layout.

The rest of the chances are improvments to the game list feature:

  • Precompiled Windows game list compiler included in src/glparse. I don't use Windows, but I was able to cross-compile with MinGW.
  • Larger game lists are supported. The maximum size of a game list file was originally 100 KB bytes, with 1000 entries. These limits have been raised by 75%.
  • Better handling of non-game entries. Pressing A on an entry with no ROM files specified before would cause the loader to try to load a non existent game (which would cause the screen to flicker). Now entries without a ROM file do nothing when A is pressed. So you can add messages to a list like this:

    Code: Select all

    Game: This is a message
    Game: Nothing happens if you press A
    Game:
    Game: You can add blank lines
    Game:
    Game: Altered Beast (This actually loads a game)
    Rom: abeast.bin
  • Links that allow switching between game lists have been added, so it's possible to separate official games, hacks, and homebrew titles or stuff like that. You can add a link with a entry using this format:

    Code: Select all

    Game: [[Go to hacks]]
    Rom: hackgamelist.bin
    Switcher

    The brackets in the "game" title aren't necessary, but currently the loader doesn't do anything to make the link stand out on it's own, so you'll have to make it clear that it does something. There's no way to automatically go back a list, you'll have to add a link that goes back.
  • Added support for a "!" section to the game list index when using the "Letter:" command. It's intended to be used to jump to links to other game lists.
  • It's possible to specify line scroll emulation with "Scroll:" entries. Possible settings are line (default), line_a4, line_b4, cell, cell_a4, cell_b4. They match up to the settings in the in-game video menu.
  • It's possible to disable shadow emulation with the option "Shadows: off"
The template generator of the game list compiler doesn't support ZIP files. That's more work than I wanted to do, so you'd have to have it run on the BIN files, compress the BIN files into ZIP files with the same name, then do a search and replace on the game list source file to replace .bin with .zip.

Also, the "data" directory in the 7z file doesn't need to be included on a disc, it's only used when compiling Gens4All. The stuff in there gets inserted directly into the 1ST_READ.

Hi, TapamN! I really appreciate the hard work you've managed to pull off with this release! It works extremely well! I just have one question. Is it possible for you to release a version of this that supports the correct aspect ratio/resolution in 240p thru S-video? A lot of users still use the Dreamcast on CRTs and the Genesis in an emulated 240p state would look amazing! I'm sure everyone who still uses S-video (and RGB and composite) would be super grateful! The Dreamcast on a CRT looks so, so good already! Genesis @ proper 240p would be the icing on the cake! Most, nearly all, CRTs don't have a VGA port and S-video is pretty close to RGB quality-wise and much better than composite.

I've read thru multiple threads and tried multiple releases but pretty much enabling/disabling 'Interlace' mode has no effect. The graphics, while they do look great, you can tell there's a blur because something is not displaying the resolution correctly? Would that be an easy fix?

Or is it possible I can compile this to display correctly myself? I just wouldn't know where to start. Thanks once again!


You can test your rig for 240p display with this disc/cdi:
viewtopic.php?f=5&t=15673

The 240p Test Suite has been a blessing the past few days! I was able to turn this RCA TruFlat TV I found on the side of the road into pretty much a beautiful looking arcade-like display!

That program is the shit. I had updated it as soon as it came out but thank you for the link and anyone else here who may see it.

240p looks absolutely amazing on this CRT. The 10 or so native 240p Dreamcast games are really something else on these old displays when calibrated correctly. Main reason I've been trying to get Gens4 to work with it correctly in terms of display. Alas, I'm not well enough equipped to handle what that entails so I guess I'll live with the resolution being sub-par for now. I may look into a Raspberry Pi with S-video out in the future. For now, I've spent nothing on this set-up (besides donating for the 240p Test Suite heh)!

User avatar
Ian Micheal
Developer
Posts: 6005
Contact:

Re: Gens4All with Z80 Emulation

Post#202 » Thu Sep 01, 2022 12:08 pm

TapamN wrote:Minor update to version 4.1:

  • No softlock when VMU is full. It's also possible to retry a save when the VMU is full by pressing A, so you can swap VMUs or delete files if you find out you don't have space. You can cancel a save by pressing B.
  • Another change is to how the in-game menu is drawn. Before, when certain raster effects happened, so many polygons could be drawn for the tilemaps that the PVR would run out of vertex memory to draw the in-game menu. Now the menu is drawn before the tilemaps, so it will never drop out.
Source and prebuilt 1ST_READ are included.

I noticed that my build of KOS seems to have a bug when calculating the date for the save file, which results messed up dates (like the year 2042 or something). It seems to be a bug in newlib for converting unix time to human readable. I started on a work around, but it looked like it would take more than 5 minutes to figure out how to safely override KOS's timestamp, so I put it off for now.

I don't know why there are problems when running on something besides VGA. Does it only happens with certain games, and not all of them? Is the in-game menu visible? Is there sound?

The emulator runs at 640x480 in the loader, and 320x240 in-game. It should auto-detect the cable and select NTSC or VGA when switching resolutions. (There's a partially finished compile-time option for aspect correct 256x224 that uses a custom resolution (640x240) that I only have working on VGA, but it's disabled by defines, so that shouldn't be the cause.)

I'm not sure how it reacts to PAL. If KOS picks 60hz, it should work as well as NTSC, but if it uses 50hz, I think there would be some problems.

I've been testing on a US Dreamcast, outputting to VGA, running from dcload-ip. I've never tried running from a CD, and I don't have a good setup right now to test interlaced video.

On a different note, I was looking through some old stuff I worked on, and found a video I recorded. I noticed the year when I recorded it. 2012. It's been about decade since then.

My main goal, DC-wise, has been make something that causes people to go, "Wow, the Dreamcast can do that?" I don't want something impressive just for homebrew, I want to upstage stuff like Le Mans, Shenmue II, or DOA2 on a technical level. I haven't accomplished that yet, and I've been wasting too much time doing "support" stuff (working on a scripting system, better PVR driver, etc.) or side projects (Gens4All, SimCity Classic) to actually get anywhere. so I've decided to just kind of drop everything and focus on making an actual 3D game of some kind.

This means I'm probably not going to do much on Gens4All for now, to focus on the game. But if someone else wants to work on improving Gens4All in the mean time, I could still give advice.


How do i get it to load roms from pc using bba i changed to skipdisk loader and change

Code: Select all

#if !SKIPLOADER
   extern void run_loader();
   run_loader();
   return 0;
#endif
   
   maple_device_t *contr = maple_enum_type(0, MAPLE_FUNC_CONTROLLER);
   cont_state_t *cond = (cont_state_t *)maple_dev_status(contr);
   printf("Funcs     %08x\n", contr->info.functions);
   printf("FuncData0 %08x\n", contr->info.function_data[0]);
   printf("FuncData1 %08x\n", contr->info.function_data[1]);
   printf("FuncData2 %08x\n", contr->info.function_data[2]);
   
   //~ Controller_1_Type |= 0x10;
   
   #define ROMDIR "/pc/home/alex/Emu/Genesis/"
   //~ int runresult = run(ROMDIR"tanglewd.bin");
   int runresult = run(ROMDIR"sonic1.gen");


To my own

Code: Select all

#define ROMDIR "/pc/home/"
//~ int runresult = run(ROMDIR"tanglewd.bin");
int runresult = run(ROMDIR"sonic1.gen");


and

Code: Select all

KOS_CFLAGS+= -DROM_PREFIX="/pc/gensrom" -DDATA_PREFIX="/rd/"

KOS_CFLAGS+= -DRAZE -DFAME

#~ KOS_CFLAGS+= -DPROFILER_GENS4ALL
KOS_CFLAGS+= -DDEBUGCOMMANDS=0
KOS_CFLAGS+= -DDEBUGDISPLAYDEFAULT=0
KOS_CFLAGS+= -DGAMELISTLOADER=1
KOS_CFLAGS+= -DSKIPTITLE=0
KOS_CFLAGS+= -DGAMELISTFNAME="/cd/gamelist.bin"
#~ KOS_CFLAGS+= -DGAMELISTFNAME="/pc/home/alex/dc/gens4all/src/glparse/gamelist.bin"
KOS_CFLAGS+= -DSKIPLOADER=0
KOS_CFLAGS+= -DINLINE68K=1
KOS_CFLAGS+= -DSORTDIR=0
KOS_CFLAGS+= -DSAVE_TO_PC=0
#~ KOS_CFLAGS+= -DVDP_HIRES
KOS_CFLAGS+= -DVDP_STRETCH_256=0


to

Code: Select all

KOS_CFLAGS+= -DROM_PREFIX="/pc/home" -DDATA_PREFIX="/rd/"

KOS_CFLAGS+= -DRAZE -DFAME

#~ KOS_CFLAGS+= -DPROFILER_GENS4ALL
KOS_CFLAGS+= -DDEBUGCOMMANDS=0
KOS_CFLAGS+= -DDEBUGDISPLAYDEFAULT=0
KOS_CFLAGS+= -DGAMELISTLOADER=1
KOS_CFLAGS+= -DSKIPTITLE=0
KOS_CFLAGS+= -DGAMELISTFNAME="/cd/gamelist.bin"
#~ KOS_CFLAGS+= -DGAMELISTFNAME="/pc/home/gamelist.bin"
KOS_CFLAGS+= -DSKIPLOADER=1
KOS_CFLAGS+= -DINLINE68K=1
KOS_CFLAGS+= -DSORTDIR=0
KOS_CFLAGS+= -DSAVE_TO_PC=0
#~ KOS_CFLAGS+= -DVDP_HIRES
KOS_CFLAGS+= -DVDP_STRETCH_256=0


and this is all that happens on console

Code: Select all

OUTPUT:>   A0: Dreamcast Controller          (01000000: Controller)
OUTPUT:>   A1: Visual Memory                 (0e000000: Clock, LCD, MemoryCard)
OUTPUT:> MAIN !!!!
OUTPUT:> Init genesis bios
OUTPUT:> Reset variables
OUTPUT:> Init CPUs
OUTPUT:> Load config
OUTPUT:> Load_Config './/gens.cfg'
OUTPUT:> vid_set_mode: 320x240 VGA
OUTPUT:> pvr: disabling vertical scaling for VGA
OUTPUT:> Main loop
OUTPUT:> Sound Rate   : 22050
OUTPUT:> Sound Enabled: 1
OUTPUT:> DAC Enabled  : 1
OUTPUT:> Z80 State    : 1
OUTPUT:> CCR: 00000105
OUTPUT:> RD: 64
OUTPUT:> Funcs     01000000
OUTPUT:> FuncData0 fe060f00
OUTPUT:> FuncData1 00000000
OUTPUT:> FuncData2 00000000
OUTPUT:> No need to save
OUTPUT:> runresult: -1
OUTPUT:> Last alloc 0x8cc0a9f0
OUTPUT:> arch: shutting down kernel
OUTPUT:> maple: final stats -- device count = 2, vbl_cntr = 43, dma_cntr = 43
OUTPUT:> vid_set_mode: 640x480 VGA
OUTPUT:> fs_romdisk: unmounting image at 0x8c0e7744 from /rd
STATE:> Upload processus completed on 9/1/2022 - 12:08:25, Exit Code : 0


It never loads into the game ? What i'm i doing wrong ?

TapamN
letterbomb
Posts: 149

Re: Gens4All with Z80 Emulation

Post#203 » Fri Sep 02, 2022 6:05 am

You're trying to boot directly into the game? runresult: -1 means that it couldn't load the ROM for some reason. Are you sure the path is correct? You have a a ROM on your PC at "/home/sonic1.gen"?

Since it prints "runresult: -1" without printing "Loading rom /pc/home/sonic1.gen...", it must be failing in Detect_Format in "src/util/rom.c" where it tries to read the first 1024 bytes to detect what kind of ROM it is (compressed or not, interleaved or not), and not at the point it's trying to load the entire file. Try adding some logging in Detect_Format to figure out what's going on.

It's also possible to load ROMs from /pc in the file browser if you re-enable the loader. Maybe that could help you figure out what's going on. Try using these flags in the Makefile:

Code: Select all

KOS_CFLAGS+= -DGAMELISTLOADER=0  #Don't try to use a gamelist, go straight to the file browser
KOS_CFLAGS+= -DSKIPTITLE=1  #Skip the title screen
KOS_CFLAGS+= -DSKIPLOADER=0  #Go into the loader, not directly into the game

It might also be useful to set DEBUGCOMMANDS to 1, which enables a bunch of keyboard commands, and allows a fast exit with L+Start. You can also use save states for testing (F5/F8 on keyboard); the path for the save state is hard coded in input.c and will need to be changed.

You can change the default directory for the file browser by changing the curdir variable's default value in loader.c, so you don't have to navigate to wherever you store the ROMs every time you boot it.

User avatar
Ian Micheal
Developer
Posts: 6005
Contact:

Re: Gens4All with Z80 Emulation

Post#204 » Fri Sep 02, 2022 7:53 am

TapamN wrote:You're trying to boot directly into the game? runresult: -1 means that it couldn't load the ROM for some reason. Are you sure the path is correct? You have a a ROM on your PC at "/home/sonic1.gen"?

Since it prints "runresult: -1" without printing "Loading rom /pc/home/sonic1.gen...", it must be failing in Detect_Format in "src/util/rom.c" where it tries to read the first 1024 bytes to detect what kind of ROM it is (compressed or not, interleaved or not), and not at the point it's trying to load the entire file. Try adding some logging in Detect_Format to figure out what's going on.

It's also possible to load ROMs from /pc in the file browser if you re-enable the loader. Maybe that could help you figure out what's going on. Try using these flags in the Makefile:

Code: Select all

KOS_CFLAGS+= -DGAMELISTLOADER=0  #Don't try to use a gamelist, go straight to the file browser
KOS_CFLAGS+= -DSKIPTITLE=1  #Skip the title screen
KOS_CFLAGS+= -DSKIPLOADER=0  #Go into the loader, not directly into the game

It might also be useful to set DEBUGCOMMANDS to 1, which enables a bunch of keyboard commands, and allows a fast exit with L+Start. You can also use save states for testing (F5/F8 on keyboard); the path for the save state is hard coded in input.c and will need to be changed.

You can change the default directory for the file browser by changing the curdir variable's default value in loader.c, so you don't have to navigate to wherever you store the ROMs every time you boot it.


thank you!! I understand what was going on now it was confusing but my dctool load was doing the wrong path even thou i had it set.. Hours spent thank you for your help As it works on my linux set up with out a problem but on dreamsdk it was doing wierd things with the paths..
:)

User avatar
megavolt85
Developer
Posts: 1823

Re: Gens4All with Z80 Emulation

Post#205 » Wed Nov 16, 2022 2:44 pm

@TapamN, the emulator turned out to be good.
I want to add SD and HDD support

User avatar
fafadou
Gold Lion
Posts: 1662

Re: Gens4All with Z80 Emulation

Post#206 » Sat Nov 19, 2022 5:46 am

megavolt85 wrote:@TapamN, the emulator turned out to be good.
I want to add SD and HDD support


May this topic can help you ?
viewtopic.php?f=5&t=15226

User avatar
megavolt85
Developer
Posts: 1823

Re: Gens4All with Z80 Emulation

Post#207 » Sat Nov 19, 2022 9:52 am

fafadou wrote:May this topic can help you ?
viewtopic.php?f=5&t=15226

no, I'm not interested in this option, native HDD support will allow you to save savestate and sram on the HDD, and you don't need to constantly build an image to add games

User avatar
megavolt85
Developer
Posts: 1823

Re: Gens4All with Z80 Emulation

Post#208 » Fri Nov 25, 2022 9:43 am

bump

gens4all_SD_HDD_native.7z
(378.15 KiB) Downloaded 142 times


gens4all_v4.3_with_HDD_support_src.7z
(713.4 KiB) Downloaded 122 times

User avatar
fafadou
Gold Lion
Posts: 1662

Re: Gens4All with Z80 Emulation

Post#209 » Fri Nov 25, 2022 1:43 pm

Can't wait to try it. You have gold in your fingers.

User avatar
fafadou
Gold Lion
Posts: 1662

Re: Gens4All with Z80 Emulation

Post#210 » Sat Nov 26, 2022 5:23 am

The icon in well design :) Everything is perfect.

I tried some "homebrew", only .bin format run, I can't use .gen roms.
Maybe there is a way to convert a .gen to .bin ?
Ultracore Ok and the sound is fantastically good.
The cursed night didn't boot, demon of asterborg neither. The emulator managed the bandswitch ?

Thanks @TampaN @Megavolt85 and all who had work on this fabulous emulator.

  • Similar Topics
    Replies
    Views
    Last post

Return to “New Releases/Homebrew/Emulation”

Who is online

Users browsing this forum: No registered users