tkashkin / GameHub

All your games in one place
https://tkashkin.github.io/projects/gamehub
GNU General Public License v3.0
2.23k stars 129 forks source link

Emulation #103

Open Hedronmx opened 5 years ago

Hedronmx commented 5 years ago

Could you add support for emulators?

tkashkin commented 5 years ago

Right now it's possible to add custom game with + button in headerbar. How do you think emulator support should be added?

Hedronmx commented 5 years ago

You could use libretro for this, use it as a source. Then the user could select which "Core" to use (A core is a game emulator, like snes9x or dolphin) and select the rom. Maybe you could use a core as a source but I believe that could be too cumbersome.

What do you think??

tkashkin commented 5 years ago

RetroArch is now supported as a compatibility layer.

Add game ROM as a custom game, force compatibility mode in its properties and select RetroArch as a compatibility layer. Then select appropriate core and run.

image

I plan to add other (not RetroArch) emulator support, emulated games source and possibly recursive game scan.

Hedronmx commented 5 years ago

Holy smokes!! That was fast! Love your platform. How can I donate?? EDIT- How do I test this? Gamehub is currently installed via ppa... Should I use the release version?

tkashkin commented 5 years ago

How can I donate??

Thanks. There were a discussion few days ago, but I have removed these comments as offtopic.

I have a couple of links in readme of dev branch, but I have problems with PayPal right now so I can't withdraw donations. Now my account is limited and will probably be banned soon. I don't know any options besides PayPal. So it's probably impossible for me to accept donations.

It may be possible to send money directly to Visa card, but I doubt it will work.

Hedronmx commented 5 years ago

Alright, I'll wait for the donations. I don't get a force compatibility layer button.. Is this normal?

tkashkin commented 5 years ago

You have probably encountered #99. In that case all games are listed as non-native. I have no idea why that happens.

This issue is so weird. It works fine on locally built version, but works wrong even when I install deb package built on the same system.

Generated C code is identical, but for some reason it works differently.

Hedronmx commented 5 years ago

So... How can I fix this? Should I disable show non native games? Or should I build the app? Mega

tkashkin commented 5 years ago

You can try to build app. It will help to understand if you have same behaviour.

git clone https://github.com/tkashkin/GameHub.git --single-branch -b dev --depth=1
cd GameHub
meson build --prefix=/usr -Ddistro=debian --buildtype=debug
cd build
ninja && src/com.github.tkashkin.gamehub --debug
Hedronmx commented 5 years ago

Built the app, force compatibility button now shows...!

tkashkin commented 5 years ago

Yes, it's very weird.

I have added logging for all variables that are used for native/non-native checks. Tested with two same games in same order. First is native, second is not.

Local not packaged:

linux windows mac | - | native non-native_compatible
windows | use need | non-native_compatible

Local packaged:

linux windows mac | - need | native non-native_compatible
windows | use need | non-native_compatible

Now interesting part:

More interesting: use_compat is defined like this:

public bool use_compat
{
    get
    {
        return needs_compat || force_compat;
    }
}

Here's the question: Why needs_compat differs and how the fuck use_compat can be false, if needs_compat is true? :confused:

Hedronmx commented 5 years ago

Another thing, when adding a rom, the ui is waiting for an argument. Maybe you could change that when I pick a file, I can save the new game. I have to add a character to the argument box and delete it, then I can save.

Edit--- Nevermind I can just add it with the built version

tkashkin commented 5 years ago

It doesn't wait for argument, it just does not correctly update when file is selected. If you select file and then change title, it will work. Fixed for the next release.

Hedronmx commented 5 years ago

Thank you so much! I love your support and app. Keep the good work!

tkashkin commented 5 years ago

Thanks.

Do you have any ideas about this weird behavior? I have no idea how can the same code work differently. valac bug? gcc bug? CPU hardware bug? :confused: I have checked C code generated by Vala compiler and it's equal (no diff and checksums are equal too).

tkashkin commented 5 years ago

I've got an idea. Package is built with optimizations (--buildtype=debugoptimized). My local version is using --buildtype=debug. I'll try to build a package without optimizations.

tkashkin commented 5 years ago

Yes, seems to be it. I'll update build scripts to disable it everywhere.

Hedronmx commented 5 years ago

Awesome! I'm waiting for the new package!

tkashkin commented 5 years ago

Hopefully should be fixed in 393c96e. Packages in releases and in PPA should be available soon. https://ci.appveyor.com/project/tkashkin/gamehub/builds/19679558 https://launchpad.net/~tkashkin/+archive/ubuntu/gamehub/+builds?build_state=all

Edit: launchpad builds can't be controlled too much, there's a chance that dpkg-buildpackage on launchpad will force some optimizations if environment variables used when building source package are not affecting source package itself. In that case try deb package from releases.

Hedronmx commented 5 years ago

Its working perfectly! One thing... Can we set the default core per game?

tkashkin commented 5 years ago

Unfortunately launchpad builds do not use DEB_BUILD_OPTIONS. Maybe there's another way to set it for launchpad. But packages from releases and AppImages/flatpaks work properly.

Its working perfectly! One thing... Can we set the default core per game?

Cores are saved in database for each game. If there's no saved core for game, last selected core since app launch should be used instead. Other compat tool options are working same way now.

Hedronmx commented 5 years ago

Comments are not showing but anyway... Can we have a small Use this setup for every launch. I use your app with a controller and having to press launch everytime sucks a bit. I want to ignore the "choose core" dialog. Thank you!

neuromancer commented 5 years ago

Can we have a small Use this setup for every launch. I use your app with a controller and having to press launch everytime sucks a bit.

We already asked for this to implement a 'big picture' mode

Hedronmx commented 5 years ago

@tkashkin Force compatibility button is not showing again... Updated from PPA Version 0.11.5-28-dev does have the button.

tkashkin commented 5 years ago

@Hedronmx

Hedronmx commented 5 years ago

Alright thank you! Sorry to bother. :D

tkashkin commented 5 years ago

It's now possible to add custom emulators. Emulators can be launched with compat tools, just like regular games.

image

To use this you need to add emulator in settings, add custom game and force "Custom emulator" as a compatibility tool for this game. Then select emulator and run.

image

tkashkin commented 5 years ago

f5b3ad0 adds emulated games import. image image

GameHub parses RetroArch cores info for supported file extensions and scans directory with find. (Some cores should probably be blacklisted as they are not that useful)

Custom emulators now can have a game file pattern. image

hlechner commented 5 years ago

I was looking to find a way to filter my console game (emulated) from the rest of the games without needing to use tags, so, here my idea:

By creating a new platform filter: Linux, Windows, Mac and Emulators.

In this idea, everything that uses retroarch or custom emulator would receive the "Emulator" platform and loses the "Linux" platform.

Not sure if it's the best approach but at least it would be possible to filter the console games and also technically it's not native from Linux/Windows/Mac would make sense to not display as native from these platforms.

tkashkin commented 5 years ago

I have added Emulated platform. You'll need to reimport emulated games to apply it.

hlechner commented 5 years ago

Awesome, working perfectly here

CorporalQuesadilla commented 5 years ago

Everything works perfectly! Only thing I've noticed is that Retroarch does not have a custom pattern option (at least, that I could find). As a result, .zip and .7z (among some other formats) are not picked up. So far these are the only two formats that are missing from my library, I'll keep you updated if I find more.

I'm not sure if the solution is just to add these missing extensions as found or to let the user have total control over which extensions are searched for.

I should mention that when it comes to file extraction, Retroarch already takes care of this on its own - there's no need to extract using GameHub and pass the result in - Retroarch can easily take in a zip (or in some (core-specific?) cases, 7z) and load only the appropriate file for its core.

tkashkin commented 5 years ago

@CorporalQuesadilla currently some cores and file extensions are ignored to not spam imported games list with possibly unrelated files:

https://github.com/tkashkin/GameHub/blob/480c20f0cf50f6d8e8407af62ffb5f39a96622a4/src/ui/dialogs/ImportEmulatedGamesDialog.vala#L36-L37

Maybe it should be configurable.

CorporalQuesadilla commented 5 years ago

That's fair, I can definitely see the benefits of having a blacklist, especially for .bin, which causes a lot of issues for users who should be using .cue in the first place. I think Genesis/MD sometimes use .bin for some ROMs, but overall the No-Intro standard is .md. Virtual Boy and DS also use .bin sometimes. Still, bin is more likely to cause issues than not.

I've also noticed that PSX cores do accept .exe - an unlikely circumstance, though. I think that most Dosbox users would likely be using a standalone build instead of the libretro core, and agree that including exe by default would likely cause more clutter.

If we're going with the blacklist approach, perhaps there could be checkboxes for each so the user becomes aware of which extensions are ignored.

If we're going with a whitelist approach, I think all extensions should appear in a comma separated textbox, alongside a list of defaults (or a reset to default button).

Personally, I prefer the whitelist approach, as a complete blacklist would be rather difficult, and somewhat less useful since Linux users often have tons of files without extensions at all while ROMs are almost always packaged with some form of semi-unique extension.

For reference, here are the extensions recognized by most major cores: "smc", "sfc", "swc", "fig", "bs", "vb", "vboy", "gd3", "gd7", "dx2", "bsx", "gb", "gbc", "bml", "rom", "st", "min", "nds", "n64", "v64", "z64", "u1", "ndd", "3ds", "3dsx", "elf", "axf", "cci", "cxi", "app", "nes", "fds", "unf", "unif", "iso", "gcm", "dol", "tgc", "wbfs", "ciso", "gcz", "wad", "gba", "agb", "dmg", "sgb", "cgb", "fd", "sap", "k7", "m7", "m5", "ri", "mx1", "mx2", "col", "dsk", "cas", "sg", "sc", "m3u", "cue", "toc", "ccd", "pbp", "chd", "img", "mdf", "cbn", "cso", "prx", "tzx", "tap", "z80", "rzx", "scl", "trd", "p", "t81", "dim", "img", "d88", "88d", "hdm", "dup", "2hd", "xdf", "hdf", "cmd", "vms", "dci", "smd", "32x", "sms", "68k", "mdx", "gen", "gg", "sg", "md", "cdi", "gdi", "game", "88", "ngp", "ngc", "d98", "98d", "fdi", "fdd", "tfd", "hdi", "thd", "nhd", "hdd", "hdn", "pce", "sgx", "int", "vec", "ws", "wsc", "pc2", "a26", "a78", "xfd", "atr", "atx", "cdm", "a52", "xex", "j64", "jag", "abs", "cof", "prg", "lnx", "st", "msa", "stx", "dim", "ipf", "sna", "tap", "cdt", "voc", "kcr"

There may be a few duplicates, but I went through every core and manually typed only the ones I felt worth including. No idea if it's any use to you, but I've been meaning to do this for my own personal projects anways. I did choose to leave out any archive formats (mostly zip and 7z) as well as anything associated with dosbox or otherwise super common formats.

tkashkin commented 5 years ago

Now blacklists are configurable in Settings/Emulators/RetroArch. Both lists should be separated by |.

hlechner commented 5 years ago

Question about the dosbox support: it should be displayed on Compatibility Layer? image

tkashkin commented 5 years ago

@hlechner yes, DOSBox is displayed as compatibility layer if there is dosbox executable somewhere in $PATH and there are .conf files in game directory.

hlechner commented 5 years ago

I was running the games directly calling the dosbox without a dosbox.conf per game but using a global one on ~/.dosbox/dosbox.conf. That's why DOSBox didn't show on the compatibility layer.

Maybe would be a good idea to document it then? I can create a wiki page if you want.

Based on Arch Linux Wiki to create a file you need to run the command (inside the DOSBox): config -wc dosbox.conf

And then you can manually edit the dosbox.conf to launch the game by adding the lines to execute the game on [autoexec] section, here the example of the game Pizza Tycoon:

MOUNT C "."
C:
PT.EXE
tkashkin commented 5 years ago

@hlechner

I don't think there's anything to improve here. Most DOSBox games have configs and GameHub should detect them.

Documentation would be nice though. I have created an issue for it. Feel free to edit wiki pages if you want. Ask me if you have any questions.

Sixdd6 commented 4 years ago

I've just found GameHub today and tried to import a Cemu game. I have set up Cemu as a custom emulator but when I go to import the game (Breath of the Wild) it fails to find the game. My folder structure is (Emulation/Games/Nintendo - WiiU/DECRYPTED/The Legend of Zelda Breath of the Wild [ALZE0101]/code/U-King.rpx) but no matter what folder I point GameHub to it just doesn't find the game at all. Also when try to add the rpx file directly it is greyed out and not selectable. So how would I go about importing exactly?

tkashkin commented 4 years ago

@Sixdd6 Have you configured Cemu as a custom emulator? To do this:

After you've configured an emulator, click + button in main window and Import emulated games.

Sixdd6 commented 4 years ago

After checking through your instructions, yes the emulator is set up just fine. The problem is that GameHub does not detect the game properly, I click the + button and browse to where the .rpx file is at but the game is not detected. I have already tried running the game through Cemu through Wine and it works fine, GameHub simply does not detect the game.

Sixdd6 commented 4 years ago

I found the problem, the values for executable and images were autofilled but not actually filled, they were slightly grey. Maybe a proper autofill for those values would be good since they disappear as soon as you click to input the exact same thing anyway.

telanus commented 4 years ago

When importing a few billion roms Gamehub seems to hang, as there is no indication that GameHub is importing anything. would be way more user friendly if there is any indication that GameHub is importing/working, since the current behaviour it looks a lot like nothing is happening and that GH has crashed