Updated EmulationStation for Windows
-
Can you send me the source code of Cemu Launcher and maybe i could help or do some executable for ous.
i have Discord but i dont know how to use jja my user is maxiducoli too.I see PCSX2 source and have a plugin named OnePAD. This plugin use gamecontrollerdb.txt and is like joysticks out the box of batocera or autoconfig of RetroArch. Can you compile this source for windows? Just the DLL. I can´t undertand too much of C++ and my HDD its only os 160GB and Visual Studio is too large for all my programs + Visual Studio Community. I can´t install for now.
See that.
/* OnePAD - author: arcum42(@gmail.com)
- Copyright (C) 2009
- Based on ZeroPAD, author zerofrog@gmail.com
- Copyright (C) 2006-2007
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "joystick.h"
#include "resources.h"
#include <signal.h> // sigaction//////////////////////////
// Joystick definitions //
//////////////////////////// opens handles to all possible joysticks
void JoystickInfo::EnumerateJoysticks(std::vector<std::unique_ptr<GamePad>> &vjoysticks)
{
uint32_t flag = SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_EVENTS | SDL_INIT_GAMECONTROLLER;if ((SDL_WasInit(0) & flag) != flag) { // Tell SDL to catch event even if the windows isn't focussed SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1"); if (SDL_Init(flag) < 0) return; // WTF! Give me back the control of my system struct sigaction action = {}; action.sa_handler = SIG_DFL; sigaction(SIGINT, &action, nullptr); sigaction(SIGTERM, &action, nullptr); SDL_JoystickEventState(SDL_QUERY); SDL_GameControllerEventState(SDL_QUERY); SDL_EventState(SDL_CONTROLLERDEVICEADDED, SDL_ENABLE); SDL_EventState(SDL_CONTROLLERDEVICEREMOVED, SDL_ENABLE); { // Support as much Joystick as possible GBytes *bytes = g_resource_lookup_data(onepad_res_get_resource(), "/onepad/res/game_controller_db.txt", G_RESOURCE_LOOKUP_FLAGS_NONE, nullptr); size_t size = 0; // SDL forget to add const for SDL_RWFromMem API... void *data = const_cast<void *>(g_bytes_get_data(bytes, &size)); SDL_GameControllerAddMappingsFromRW(SDL_RWFromMem(data, size), 1); g_bytes_unref(bytes); // Add user mapping too for (auto const &map : g_conf.sdl2_mapping) SDL_GameControllerAddMapping(map.c_str()); } } vjoysticks.clear(); for (int i = 0; i < SDL_NumJoysticks(); ++i) { vjoysticks.push_back(std::unique_ptr<GamePad>(new JoystickInfo(i))); // Something goes wrong in the init, let's drop it if (!vjoysticks.back()->IsProperlyInitialized()) vjoysticks.pop_back(); }
}
void JoystickInfo::Rumble(unsigned type, unsigned pad)
{
if (type >= m_effects_id.size())
return;if (!(g_conf.pad_options[pad].forcefeedback)) return; if (m_haptic == nullptr) return; int id = m_effects_id[type]; if (SDL_HapticRunEffect(m_haptic, id, 1) != 0) { fprintf(stderr, "ERROR: Effect is not working! %s, id is %d\n", SDL_GetError(), id); }
}
JoystickInfo::~JoystickInfo()
{
// Haptic must be closed before the joystick
if (m_haptic != nullptr) {
for (const auto &eid : m_effects_id) {
if (eid >= 0)
SDL_HapticDestroyEffect(m_haptic, eid);
}SDL_HapticClose(m_haptic); } if (m_controller != nullptr) {
#if SDL_MINOR_VERSION >= 4
// Version before 2.0.4 are bugged, JoystickClose crashes randomly
// Note: GameControllerClose calls JoystickClose)
SDL_GameControllerClose(m_controller);
#endif
}
}JoystickInfo::JoystickInfo(int id)
: GamePad()
, m_controller(nullptr)
, m_haptic(nullptr)
, m_unique_id(0)
{
SDL_Joystick *joy = nullptr;
m_effects_id.fill(-1);
// Values are hardcoded currently but it could be later extended to allow remapping of the buttons
m_pad_to_sdl[PAD_L2] = SDL_CONTROLLER_AXIS_TRIGGERLEFT;
m_pad_to_sdl[PAD_R2] = SDL_CONTROLLER_AXIS_TRIGGERRIGHT;
m_pad_to_sdl[PAD_L1] = SDL_CONTROLLER_BUTTON_LEFTSHOULDER;
m_pad_to_sdl[PAD_R1] = SDL_CONTROLLER_BUTTON_RIGHTSHOULDER;
m_pad_to_sdl[PAD_TRIANGLE] = SDL_CONTROLLER_BUTTON_Y;
m_pad_to_sdl[PAD_CIRCLE] = SDL_CONTROLLER_BUTTON_B;
m_pad_to_sdl[PAD_CROSS] = SDL_CONTROLLER_BUTTON_A;
m_pad_to_sdl[PAD_SQUARE] = SDL_CONTROLLER_BUTTON_X;
m_pad_to_sdl[PAD_SELECT] = SDL_CONTROLLER_BUTTON_BACK;
m_pad_to_sdl[PAD_L3] = SDL_CONTROLLER_BUTTON_LEFTSTICK;
m_pad_to_sdl[PAD_R3] = SDL_CONTROLLER_BUTTON_RIGHTSTICK;
m_pad_to_sdl[PAD_START] = SDL_CONTROLLER_BUTTON_START;
m_pad_to_sdl[PAD_UP] = SDL_CONTROLLER_BUTTON_DPAD_UP;
m_pad_to_sdl[PAD_RIGHT] = SDL_CONTROLLER_BUTTON_DPAD_RIGHT;
m_pad_to_sdl[PAD_DOWN] = SDL_CONTROLLER_BUTTON_DPAD_DOWN;
m_pad_to_sdl[PAD_LEFT] = SDL_CONTROLLER_BUTTON_DPAD_LEFT;
m_pad_to_sdl[PAD_L_UP] = SDL_CONTROLLER_AXIS_LEFTY;
m_pad_to_sdl[PAD_L_RIGHT] = SDL_CONTROLLER_AXIS_LEFTX;
m_pad_to_sdl[PAD_L_DOWN] = SDL_CONTROLLER_AXIS_LEFTY;
m_pad_to_sdl[PAD_L_LEFT] = SDL_CONTROLLER_AXIS_LEFTX;
m_pad_to_sdl[PAD_R_UP] = SDL_CONTROLLER_AXIS_RIGHTY;
m_pad_to_sdl[PAD_R_RIGHT] = SDL_CONTROLLER_AXIS_RIGHTX;
m_pad_to_sdl[PAD_R_DOWN] = SDL_CONTROLLER_AXIS_RIGHTY;
m_pad_to_sdl[PAD_R_LEFT] = SDL_CONTROLLER_AXIS_RIGHTX;if (SDL_IsGameController(id)) { m_controller = SDL_GameControllerOpen(id); joy = SDL_GameControllerGetJoystick(m_controller); } else { joy = SDL_JoystickOpen(id); } if (joy == nullptr) { fprintf(stderr, "onepad:failed to open joystick %d\n", id); return; } // Collect Device Information char guid[64]; SDL_JoystickGetGUIDString(SDL_JoystickGetGUID(joy), guid, 64); const char *devname = SDL_JoystickNameForIndex(id); if (m_controller == nullptr) { fprintf(stderr, "onepad: Joystick (%s,GUID:%s) isn't yet supported by the SDL2 game controller API\n" "Fortunately you can use AntiMicro (https://github.com/AntiMicro/antimicro) or Steam to configure your joystick\n" "The mapping can be stored in OnePAD2.ini as 'SDL2 = <...mapping description...>'\n" "Please report it to us (https://github.com/PCSX2/pcsx2/issues) so we can add your joystick to our internal database.", devname, guid);
#if SDL_MINOR_VERSION >= 4 // Version before 2.0.4 are bugged, JoystickClose crashes randomly
SDL_JoystickClose(joy);
#endifreturn; } std::hash<std::string> hash_me; m_unique_id = hash_me(std::string(guid)); // Default haptic effect SDL_HapticEffect effects[NB_EFFECT]; for (int i = 0; i < NB_EFFECT; i++) { SDL_HapticEffect effect; memset(&effect, 0, sizeof(SDL_HapticEffect)); // 0 is safe default SDL_HapticDirection direction; direction.type = SDL_HAPTIC_POLAR; // We'll be using polar direction encoding. direction.dir[0] = 18000; effect.periodic.direction = direction; effect.periodic.period = 10; effect.periodic.magnitude = (Sint16)(g_conf.get_ff_intensity()); // Effect at maximum instensity effect.periodic.offset = 0; effect.periodic.phase = 18000; effect.periodic.length = 125; // 125ms feels quite near to original effect.periodic.delay = 0; effect.periodic.attack_length = 0; /* Sine and triangle are quite probably the best, don't change that lightly and if you do * keep effects ordered by type */ if (i == 0) { /* Effect for small motor */ /* Sine seems to be the only effect making little motor from DS3/4 react * Intensity has pretty much no effect either(which is coherent with what is explain in hid_sony driver */ effect.type = SDL_HAPTIC_SINE; } else { /** Effect for big motor **/ effect.type = SDL_HAPTIC_TRIANGLE; } effects[i] = effect; } if (SDL_JoystickIsHaptic(joy)) { m_haptic = SDL_HapticOpenFromJoystick(joy); for (auto &eid : m_effects_id) { eid = SDL_HapticNewEffect(m_haptic, &effects[0]); if (eid < 0) { fprintf(stderr, "ERROR: Effect is not uploaded! %s\n", SDL_GetError()); return; } } } fprintf(stdout, "onepad: controller (%s) detected%s, GUID:%s\n", devname, m_haptic ? " with rumble support" : "", guid); m_no_error = true;
}
const char *JoystickInfo::GetName()
{
return SDL_JoystickName(SDL_GameControllerGetJoystick(m_controller));
}size_t JoystickInfo::GetUniqueIdentifier()
{
return m_unique_id;
}bool JoystickInfo::TestForce(float strength = 0.60)
{
// This code just use standard rumble to check that SDL handles the pad correctly! --3kinox
if (m_haptic == nullptr)
return false; // Otherwise, core dump!SDL_HapticRumbleInit(m_haptic); // Make the haptic pad rumble 60% strength for half a second, shoudld be enough for user to see if it works or not if (SDL_HapticRumblePlay(m_haptic, strength, 400) != 0) { fprintf(stderr, "ERROR: Rumble is not working! %s\n", SDL_GetError()); return false; } return true;
}
int JoystickInfo::GetInput(gamePadValues input)
{
float k = g_conf.get_sensibility() / 100.0; // convert sensibility to float// Handle analog inputs which range from -32k to +32k. Range conversion is handled later in the controller if (IsAnalogKey(input)) { int value = SDL_GameControllerGetAxis(m_controller, (SDL_GameControllerAxis)m_pad_to_sdl[input]); value *= k; return (abs(value) > m_deadzone) ? value : 0; } // Handle triggers which range from 0 to +32k. They must be converted to 0-255 range if (input == PAD_L2 || input == PAD_R2) { int value = SDL_GameControllerGetAxis(m_controller, (SDL_GameControllerAxis)m_pad_to_sdl[input]); return (value > m_deadzone) ? value / 128 : 0; } // Remain buttons int value = SDL_GameControllerGetButton(m_controller, (SDL_GameControllerButton)m_pad_to_sdl[input]); return value ? 0xFF : 0; // Max pressure
}
void JoystickInfo::UpdateGamePadState()
{
SDL_GameControllerUpdate();
}SDL and load allmost all joysticks.
I hope you can understandme.
Bye!
-
This is the Xinput Lillypad.ini CFG for ALL Xinput controllers (if you install SCP Toolkit you can use every controller for PCSX2 with out config the buttons.
-
@maxiducoli said in Updated EmulationStation for Windows:
This is the Xinput Lillypad.ini CFG for ALL Xinput controllers (if you install SCP Toolkit you can use every controller for PCSX2 with out config the buttons.
[General Settings]
Last Config Path=inis
Last Config Name=LilyPad.lily
Force Cursor Hide=0
Mouse Unfocus=1
Background=1
Multiple Bindings=0
DirectInput Game Devices=1
XInput=1
DualShock 3=0
Multitap 1=0
Multitap 2=0
Escape Fullscreen Hack=0
Disable Screen Saver=0
Logging=0
Save State in Title=0
GH2=0
Turbo Key Hack=0
Vista Volume=1
Close Hacks=0
Keyboard Mode=2
Mouse Mode=0
Volume=100
[Pad 0 0]
Mode=1
Auto Analog=0
[Pad 0 1]
Mode=1
Auto Analog=0
[Pad 0 2]
Mode=1
Auto Analog=0
[Pad 0 3]
Mode=1
Auto Analog=0
[Pad 1 0]
Mode=1
Auto Analog=0
[Pad 1 1]
Mode=1
Auto Analog=0
[Pad 1 2]
Mode=1
Auto Analog=0
[Pad 1 3]
Mode=1
Auto Analog=0
[Device 0]
Display Name=XInput Pad 0
Instance ID=XInput Pad 0
API=4
Type=3
Binding 0=0x00040000, 0, 20, 65536, 0, 0, 0
Binding 1=0x00040001, 0, 22, 65536, 0, 0, 0
Binding 2=0x00040002, 0, 23, 65536, 0, 0, 0
Binding 3=0x00040003, 0, 21, 65536, 0, 0, 0
Binding 4=0x00040004, 0, 19, 65536, 0, 0, 0
Binding 5=0x00040005, 0, 16, 65536, 0, 0, 0
Binding 6=0x00040006, 0, 17, 65536, 0, 0, 0
Binding 7=0x00040007, 0, 18, 65536, 0, 0, 0
Binding 8=0x00040008, 0, 26, 65536, 0, 0, 0
Binding 9=0x00040009, 0, 27, 65536, 0, 0, 0
Binding 10=0x0004000C, 0, 30, 65536, 0, 0, 0
Binding 11=0x0004000D, 0, 29, 65536, 0, 0, 0
Binding 12=0x0004000E, 0, 31, 65536, 0, 0, 0
Binding 13=0x0004000F, 0, 28, 65536, 0, 0, 0
Binding 14=0x00200010, 0, 24, 65536, 0, 0, 1
Binding 15=0x00200011, 0, 25, 65536, 0, 0, 1
Binding 16=0x01020012, 0, 33, 87183, 0, 0, 13172
Binding 17=0x02020012, 0, 35, 87183, 0, 0, 13172
Binding 18=0x01020013, 0, 32, 87183, 0, 0, 13172
Binding 19=0x02020013, 0, 34, 87183, 0, 0, 13172
Binding 20=0x01020014, 0, 37, 87183, 0, 0, 13172
Binding 21=0x02020014, 0, 39, 87183, 0, 0, 13172
Binding 22=0x01020015, 0, 36, 87183, 0, 0, 13172
Binding 23=0x02020015, 0, 38, 87183, 0, 0, 13172
FF Binding 0=Constant 0, 0, 0, 0, 65536, 1, 0
FF Binding 1=Constant 0, 1, 0, 0, 0, 1, 65536
[Device 1]
Display Name=XInput Pad 1
Instance ID=XInput Pad 1
API=4
Type=3
Binding 0=0x00040000, 1, 20, 65536, 0, 0, 0
Binding 1=0x00040001, 1, 22, 65536, 0, 0, 0
Binding 2=0x00040002, 1, 23, 65536, 0, 0, 0
Binding 3=0x00040003, 1, 21, 65536, 0, 0, 0
Binding 4=0x00040004, 1, 19, 65536, 0, 0, 0
Binding 5=0x00040005, 1, 16, 65536, 0, 0, 0
Binding 6=0x00040006, 1, 17, 65536, 0, 0, 0
Binding 7=0x00040007, 1, 18, 65536, 0, 0, 0
Binding 8=0x00040008, 1, 26, 65536, 0, 0, 0
Binding 9=0x00040009, 1, 27, 65536, 0, 0, 0
Binding 10=0x0004000C, 1, 30, 65536, 0, 0, 0
Binding 11=0x0004000D, 1, 29, 65536, 0, 0, 0
Binding 12=0x0004000E, 1, 31, 65536, 0, 0, 0
Binding 13=0x0004000F, 1, 28, 65536, 0, 0, 0
Binding 14=0x00200010, 1, 24, 65536, 0, 0, 1
Binding 15=0x00200011, 1, 25, 65536, 0, 0, 1
Binding 16=0x01020012, 1, 33, 87183, 0, 0, 13172
Binding 17=0x02020012, 1, 35, 87183, 0, 0, 13172
Binding 18=0x01020013, 1, 32, 87183, 0, 0, 13172
Binding 19=0x02020013, 1, 34, 87183, 0, 0, 13172
Binding 20=0x01020014, 1, 37, 87183, 0, 0, 13172
Binding 21=0x02020014, 1, 39, 87183, 0, 0, 13172
Binding 22=0x01020015, 1, 36, 87183, 0, 0, 13172
Binding 23=0x02020015, 1, 38, 87183, 0, 0, 13172
FF Binding 0=Constant 1, 0, 0, 0, 65536, 1, 0
FF Binding 1=Constant 1, 1, 0, 0, 0, 1, 65536
[Device 12]
Display Name=XInput Pad 2
Instance ID=XInput Pad 2
API=4
Type=3
[Device 13]
Display Name=XInput Pad 3
Instance ID=XInput Pad 3
API=4
Type=3
-
@maxiducoli
What do you want me to do with all this ? It's not really related to ES.
Plus, it's not the good place for that kind of exchanges. Find me on Discord.
I can't see you on any server I'm in. Please, name servers you are in so I can find you. -
@f-caruso hi was just wondering if you will update the gamesdb scraper at some point, I want to use your screenscraper one but I cant choose to have only 2d boxes! Thanks
-
@porterballs said in Updated EmulationStation for Windows:
gamesdb
Done + Added ability to use Box as image for screenscraper. You can download the latest version.
-
@f-caruso thank you much appreciated :)
-
-
@CarissaIsWierd The version of your theme I have does'nt have all these options, so I can't test what you did...
EDIT : Found & fixed -
@f-caruso Did you do something to the way "folderImage" & "gameImage" are displayed in the past month? If you check my theme I shared with you, folders and games without images show up like this, when before they used minSize like games with images do. Do I need to add something different to fix it?
-
@CarissaIsWierd Check the new release it should solve your case.
-
@f-caruso @jdrassa Will it be possible to use animated Gifs for the Covers? Not only .png or .jpg. It would be Awesome to have a Animated Cover like this: Animated Cover
-
@PittStone said in Updated EmulationStation for Windows:
It would be Awesome to have a Animated Cover like this: Animated Cover
That's not a GIF, is a video file. You can add it as video in ES.
-
@mitu Hi, nope i right click on it and JDownloader downloaded it as a .gif! It doesn't matter if this example is a video or a gif! My question is whether it will even be possible to use this as an animated gif.
-
@PittStone said in Updated EmulationStation for Windows:
Hi, nope i right click on it and JDownloader downloaded it as a .gif
Imgur allows you to upload short video files. The actual video behind that it's an MP4 video - https://i.imgur.com/193xjy7.mp4.
My question is whether it will even be possible to use this as an animated gif.
I don't think it's possible without adding a GIF decoder (not included right now in EmulationStation) and playing it as a video in ES - at which point you're better just adding it as
video
. -
@mitu If you look at my update from the Magazine Theme, you can see that the cover is permanently displayed on the left and the videosnap is also played on the right.
But it is possible with a gif decoder. Then something should be in a next update. :D
It would be very nice to have this for a Raspberry pi 3, too. -
@f-caruso have you, or anyone, observed this issue in fabricecaruso's build(windows)?
last played is not showing some systems' entries. It is showing the games (inside last played) from nes, snes, nintendo64, fds, mastersystem, psx etc. but not showing from fba, model2, pspmini etc. entries are being added to gamelist.xml files. but not visible inside last played. jdrassa's build is perfectly fine here.
i have changed the list view to "lastplayed, descending" in select(button) menu and also tried different options. looks like some of the systems are getting filtered out inside the lastplayed.
btw, this is my first post. so hello everyone:) -
I haven't gone back far enough in this thread to look but, have you considered allowing videos on the carousel / system page @f-caruso ?
-
Can we change which folders the media scraped from Screenscraper saves to?
-
@santo-vfx Hello. I've just fixed it.
@LiveFastCyYoung
allowing videos on the carousel / system page
Yes it's possible for a while now using extras. See my carbon theme fork, it contains sample of that. Or have a look at Hypertocera theme for batocera which is compatible with my fork.
Can we change which folders the media scraped from Screenscraper saves to?
Not with the internal scrapper, sorry & I don't have plans to change that.
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.