Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,8 @@ def update_n64_controller_config(controller_number: int, /):
"mame078plus" : { "default" : { "device": 4, "p1": 0, "p2": 1 } },
"flycast" : { "default" : { "device": 4, "p1": 0, "p2": 1, "p3": 2, "p4": 3 } },
"flycastvl" : { "default" : { "device": 4, "p1": 0, "p2": 1, "p3": 2, "p4": 3 } },
"mednafen_psx" : { "default" : { "device": 260, "p1": 0, "p2": 1 } },
"mednafen_psx" : { "default" : { "device": 260, "p1": 0, "p2": 1,
"gameDependant": [ { "key": "type", "value": "justifier", "mapkey": "device", "mapvalue": "516" } ]} },
"pcsx_rearmed" : { "default" : { "device": 260, "p1": 0, "p2": 1,
"gameDependant": [ { "key": "type", "value": "justifier", "mapkey": "device", "mapvalue": "516" } ]} },
"swanstation" : { "default" : { "device": 260, "p1": 0, "p2": 1 } },
Expand Down Expand Up @@ -918,6 +919,18 @@ def configureGunInputsForPlayer(
pedalconfig = f'input_player{n}_gun_aux_a'
retroarchConfig[f'input_player{n}_gun_aux_b_mbtn' ] = 3

if core == "mednafen_psx":
if "gun_type" in metadata and metadata["gun_type"] == "justifier":
retroarchConfig[f'input_player{n}_gun_offscreen_shot_mbtn'] = ''
retroarchConfig[f'input_player{n}_gun_aux_a_mbtn' ] = 2
pedalconfig = f'input_player{n}_gun_aux_a'
else:
retroarchConfig[f'input_player{n}_gun_offscreen_shot_mbtn'] = ''
retroarchConfig[f'input_player{n}_gun_start_mbtn' ] = ''
retroarchConfig[f'input_player{n}_gun_aux_a_mbtn' ] = 2
pedalconfig = f'input_player{n}_gun_aux_a'
retroarchConfig[f'input_player{n}_gun_aux_b_mbtn' ] = 3

if core == "fbneo":
retroarchConfig[f'input_player{n}_gun_offscreen_shot_mbtn'] = ''
retroarchConfig[f'input_player{n}_gun_aux_a_mbtn' ] = 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2083,33 +2083,107 @@ def _ppsspp_options(
def _mednafen_psx_options(
coreSettings: UnixSettings, system: Emulator, rom: Path, guns: Guns, wheels: DeviceInfoMapping, /,
) -> None:
# CPU Frequency Scaling (Overclock)
_set_from_system(coreSettings, 'beetle_psx_hw_cpu_freq_scale', system, 'beetle_psx_hw_cpu_freq_scale', default='110%') # If not 110% NO options are working!
# --- System ---

# Show official Bootlogo
_set_from_system(coreSettings, 'beetle_psx_hw_skip_bios', system, 'beetle_psx_hw_skip_bios', default='disabled')

# CPU Frequency Scaling (Overclock)
_set_from_system(coreSettings, 'beetle_psx_hw_cpu_freq_scale', system, 'beetle_psx_hw_cpu_freq_scale', default='110%') # If not 110% NO options are working!

# CD Access Method
_set_from_system(coreSettings, 'beetle_psx_hw_cd_access_method', system, 'beetle_psx_hw_cd_access_method', default='sync')

# CD Loading Speed
_set_from_system(coreSettings, 'beetle_psx_hw_cd_fastload', system, 'beetle_psx_hw_cd_fastload', default='2x(native)')

# Analog Stick self calibration
_set_from_system(coreSettings, 'beetle_psx_hw_analog_calibration', system, 'beetle_psx_hw_analog_calibration', default='disabled')

# --- Video ---

# Video Resolution
_set_from_system(coreSettings, 'beetle_psx_hw_internal_resolution', system, 'beetle_psx_hw_internal_resolution', default='1x(native)')

# Core Aspect Ratio
_set_from_system(coreSettings, 'beetle_psx_hw_aspect_ratio', system, 'beetle_psx_hw_aspect_ratio', default='corrected')

# Renderer
_set_from_system(coreSettings, 'beetle_psx_hw_renderer', system, 'beetle_psx_hw_renderer', default='hardware')

# Software Framebuffer
_set_from_system(coreSettings, 'beetle_psx_hw_renderer_software_fb', system, 'beetle_psx_hw_renderer_software_fb', default='enabled')

# Internal Color Depth
_set_from_system(coreSettings, 'beetle_psx_hw_depth', system, 'beetle_psx_hw_depth', default='16bpp(native)')

# Dithering Pattern
_set_from_system(coreSettings, 'beetle_psx_hw_dither_mode', system, 'beetle_psx_hw_dither_mode', default='1x(native)')

# Texture Filtering
_set_from_system(coreSettings, 'beetle_psx_hw_filter', system, 'beetle_psx_hw_filter', default='nearest')

# Exclude Sprites from Filtering (Vulkan)
_set_from_system(coreSettings, 'beetle_psx_hw_filter_exclude_sprite', system, 'beetle_psx_hw_filter_exclude_sprite', default='disabled')

# Exclude 2D Polygons from Filtering (Vulkan)
_set_from_system(coreSettings, 'beetle_psx_hw_filter_exclude_2d_polygon', system, 'beetle_psx_hw_filter_exclude_2d_polygon', default='disabled')

# Adaptive Smoothing (Vulkan)
_set_from_system(coreSettings, 'beetle_psx_hw_adaptive_smoothing', system, 'beetle_psx_hw_adaptive_smoothing', default='disabled')

# Supersampling (Vulkan)
_set_from_system(coreSettings, 'beetle_psx_hw_super_sampling', system, 'beetle_psx_hw_super_sampling', default='disabled')

# Multi-Sampled Anti Aliasing (Vulkan)
_set_from_system(coreSettings, 'beetle_psx_hw_msaa', system, 'beetle_psx_hw_msaa', default='1x')

# MDEC YUV Chroma Filter (Vulkan)
_set_from_system(coreSettings, 'beetle_psx_hw_mdec_yuv', system, 'beetle_psx_hw_mdec_yuv', default='disabled')

# PAL Video Timing Override
_set_from_system(coreSettings, 'beetle_psx_hw_pal_video_timing_override', system, 'beetle_psx_hw_pal_video_timing_override', default='disabled')

# Frame Duping (Speedup)
_set_from_system(coreSettings, 'beetle_psx_hw_frame_duping', system, 'beetle_psx_hw_frame_duping', default='disabled')

# --- PGXP (Precision Geometry Transform Pipeline) ---

# PGXP Operation Mode
_set_from_system(coreSettings, 'beetle_psx_hw_pgxp_mode', system, 'beetle_psx_hw_pgxp_mode', default='disabled')

# PGXP 2D Geometry Tolerance
_set_from_system(coreSettings, 'beetle_psx_hw_pgxp_2d_tol', system, 'beetle_psx_hw_pgxp_2d_tol', default='disabled')

# PGXP Primitive Culling
_set_from_system(coreSettings, 'beetle_psx_hw_pgxp_nclip', system, 'beetle_psx_hw_pgxp_nclip', default='disabled')

# PGXP Vertex Cache
_set_from_system(coreSettings, 'beetle_psx_hw_pgxp_vertex', system, 'beetle_psx_hw_pgxp_vertex', default='disabled')

# PGXP Perspective Correct Texturing
_set_from_system(coreSettings, 'beetle_psx_hw_pgxp_texture', system, 'beetle_psx_hw_pgxp_texture', default='disabled')

# --- Emulation Hacks ---

# Line-to-Quad Hack
_set_from_system(coreSettings, 'beetle_psx_hw_line_render', system, 'beetle_psx_hw_line_render', default='default')

# Widescreen Hack
if system.config.get('beetle_psx_hw_widescreen_hack') == 'enabled' and system.config.get('ratio') == "16/9" and system.config.get('bezel') == "none":
_set(coreSettings, 'beetle_psx_hw_widescreen_hack', 'enabled')
else:
_set(coreSettings, 'beetle_psx_hw_widescreen_hack', 'disabled')

# Frame Duping (Speedup)
_set_from_system(coreSettings, 'beetle_psx_hw_frame_duping', system, 'beetle_psx_hw_frame_duping', default='disabled')
# Widescreen Hack Aspect Ratio
_set_from_system(coreSettings, 'beetle_psx_hw_widescreen_hack_aspect_ratio', system, 'beetle_psx_hw_widescreen_hack_aspect_ratio', default='16:9')

# CPU Dynarec (Speedup)
_set_from_system(coreSettings, 'beetle_psx_hw_cpu_dynarec', system, 'beetle_psx_hw_cpu_dynarec', default='disabled')

# Dynarec Code Invalidation
_set_from_system(coreSettings, 'beetle_psx_hw_dynarec_invalidate', system, 'beetle_psx_hw_dynarec_invalidate', default='full')

# Analog Stick self calibration
_set(coreSettings, 'beetle_psx_hw_analog_calibration', 'enabled')

# Multitap
match system.config.get('multitap_mednafen'):
case 'port1':
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
--- a/mednafen/psx/frontio.c
+++ b/mednafen/psx/frontio.c
@@ -4656,35 +4656,46 @@ static int32_t InputDevice_GunCon_GPULineHook(InputDevice *self_, const int32_t
InputDevice_GunCon *self = (InputDevice_GunCon *)self_;

if(vsync && !self->prev_vsync)
self->line_counter = 0;

- if(pixels && pix_clock)
+ if(pix_clock)
{
const int avs = 16; /* Not 16 for PAL, fixme. */
int32_t gx;
int32_t gy;
int32_t ix;

gx = (self->nom_x * 2 + pix_clock_divider) / (pix_clock_divider * 2);
gy = self->nom_y;

- for (ix = gx; ix < (gx + (int32_t)(pix_clock / 762925)); ix++)
+ if(pixels)
{
- if(ix >= 0 && ix < (int)width && self->line_counter >= (avs + gy) && self->line_counter < (avs + gy + 8))
+ for (ix = gx; ix < (gx + (int32_t)(pix_clock / 762925)); ix++)
{
- int r, g, b, a;
+ if(ix >= 0 && ix < (int)width && self->line_counter >= (avs + gy) && self->line_counter < (avs + gy + 8))
+ {
+ int r, g, b, a;

- MDFN_DecodeColor(pixels[ix * upscale_factor], &r, &g, &b, &a);
+ MDFN_DecodeColor(pixels[ix * upscale_factor], &r, &g, &b, &a);

- if((r + g + b) >= 0x40) /* Wrong, but not COMPLETELY ABSOLUTELY wrong, at least. ;) */
- {
- self->hit_x = (int64_t)(ix + pix_clock_offset) * 8000000 / pix_clock; /* GunCon has what appears to be an 8.00MHz ceramic resonator in it. */
- self->hit_y = self->line_counter;
+ if((r + g + b) >= 0x40) /* Wrong, but not COMPLETELY ABSOLUTELY wrong, at least. ;) */
+ {
+ self->hit_x = (int64_t)(ix + pix_clock_offset) * 8000000 / pix_clock; /* GunCon has what appears to be an 8.00MHz ceramic resonator in it. */
+ self->hit_y = self->line_counter;
+ }
}
}
}
+ else if(self->line_counter == (avs + gy))
+ {
+ /* HW renderer has no readable framebuffer to sample brightness
+ * from, so approximate the hit directly from the gun's aim
+ * position instead of genuine light detection. */
+ self->hit_x = (int64_t)(gx + pix_clock_offset) * 8000000 / pix_clock;
+ self->hit_y = self->line_counter;
+ }

self->base.chair_x = gx;
self->base.chair_y = (avs + gy) - self->line_counter;
}

@@ -5003,11 +5014,11 @@ static int32_t InputDevice_Justifier_GPULineHook(InputDevice *self_, const int32
int32_t ret = PSX_EVENT_MAXTS;

if(vsync && !self->prev_vsync)
self->line_counter = 0;

- if(pixels && pix_clock)
+ if(pix_clock)
{
const int avs = 16; /* Not 16 for PAL, fixme. */
int32_t gx;
int32_t gy;
int32_t gxa;
@@ -5018,16 +5029,26 @@ static int32_t InputDevice_Justifier_GPULineHook(InputDevice *self_, const int32
/* if(gxa < 0 && gx >= 0) */
/* gxa = 0; */

if(!self->os_shot_counter && self->need_hit_detect && gxa >= 0 && gxa < (int)width && self->line_counter >= (avs + gy - 1) && self->line_counter <= (avs + gy + 1))
{
- int r, g, b, a;
+ if(pixels)
+ {
+ int r, g, b, a;

- MDFN_DecodeColor(pixels[gxa * upscale_factor], &r, &g, &b, &a);
+ MDFN_DecodeColor(pixels[gxa * upscale_factor], &r, &g, &b, &a);

- if((r + g + b) >= 0x40) /* Wrong, but not COMPLETELY ABSOLUTELY wrong, at least. ;) */
+ if((r + g + b) >= 0x40) /* Wrong, but not COMPLETELY ABSOLUTELY wrong, at least. ;) */
+ {
+ ret = timestamp + (int64_t)(gxa + pix_clock_offset) * (44100 * 768) / pix_clock - 177;
+ }
+ }
+ else
{
+ /* HW renderer has no readable framebuffer to sample brightness
+ * from, so approximate the hit directly from the gun's aim
+ * position instead of genuine light detection. */
ret = timestamp + (int64_t)(gxa + pix_clock_offset) * (44100 * 768) / pix_clock - 177;
}
}

self->base.chair_x = gx;
Loading
Loading