Skip to content

Commit

Permalink
Flycast macros, Fixed nes crashing issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
RossenX committed Sep 14, 2021
1 parent 505b218 commit c1f7d03
Show file tree
Hide file tree
Showing 6 changed files with 149 additions and 3 deletions.
Binary file modified .vs/NullDC BEAR/v16/.suo
Binary file not shown.
7 changes: 7 additions & 0 deletions NullDC CvS2 BEAR/MednafenLauncher.vb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Public Class MednafenLauncher

Dim LineCount = 0
For Each _line In _mednafenConfigs

If _line.Length > 1 Then
For Each _optimization As String In SpecialSettings
If _line.StartsWith(_optimization.Split(" ")(0).Trim & " ") Then
Expand All @@ -55,6 +56,12 @@ Public Class MednafenLauncher
_mednafenConfigs(LineCount) = "sound.volume " & MainformRef.ConfigFile.EmulatorVolume
End If

If _line.StartsWith("nes.input.port") Then
If Not _line.Split(" ")(1) = "none" And Not _line.Split(" ")(1) = "gamepad" And Not _line.Split(" ")(1) = "zapper" Then
_mednafenConfigs(LineCount) = _line.Split(" ")(0) & " gamepad"
End If
End If

End If

LineCount += 1
Expand Down
Binary file modified NullDC CvS2 BEAR/Resources/Updates.zip
Binary file not shown.
96 changes: 96 additions & 0 deletions NullDC CvS2 BEAR/frmKeyMapperSDL.vb
Original file line number Diff line number Diff line change
Expand Up @@ -1414,6 +1414,53 @@ Public Class frmKeyMapperSDL
DoAnnoyingFlycastStuff(CompatStuff, DreamcastStuff, EmulatorStuff, "axis_btn_z", "btn_z", _line, _player, _ControllerName, False)
End If

' MACROS
'I_BC_345 = k0|k0
'I_BC_012 = k0|k0
'I_BC_45 = k0|k0
'I_BC_34 = k0|k0
'I_BC_12 = k0|k0
'I_BC_01 = k0|k0
'I_BC_25 = k0|k0
'I_BC_14 = k0|k0
'I_BC_03 = k0|k0

If _line.StartsWith("I_BC_03=") Then '
DoAnnoyingFlycastStuff(CompatStuff, CompatStuff, CompatStuff, "axis_1+4", "1+4", _line, _player, _ControllerName, False)
End If

If _line.StartsWith("I_BC_14=") Then '
DoAnnoyingFlycastStuff(CompatStuff, CompatStuff, CompatStuff, "axis_2+5", "2+5", _line, _player, _ControllerName, False)
End If

If _line.StartsWith("I_BC_25=") Then '
DoAnnoyingFlycastStuff(CompatStuff, CompatStuff, CompatStuff, "axis_3+6", "3+6", _line, _player, _ControllerName, False)
End If

If _line.StartsWith("I_BC_01=") Then '
DoAnnoyingFlycastStuff(CompatStuff, CompatStuff, CompatStuff, "axis_1+2", "1+2", _line, _player, _ControllerName, False)
End If

If _line.StartsWith("I_BC_12=") Then '
DoAnnoyingFlycastStuff(CompatStuff, CompatStuff, CompatStuff, "axis_2+3", "2+3", _line, _player, _ControllerName, False)
End If

If _line.StartsWith("I_BC_34=") Then '
DoAnnoyingFlycastStuff(CompatStuff, CompatStuff, CompatStuff, "axis_4+5", "4+5", _line, _player, _ControllerName, False)
End If

If _line.StartsWith("I_BC_45=") Then '
DoAnnoyingFlycastStuff(CompatStuff, CompatStuff, CompatStuff, "axis_5+6", "5+6", _line, _player, _ControllerName, False)
End If

If _line.StartsWith("I_BC_012=") Then '
DoAnnoyingFlycastStuff(CompatStuff, CompatStuff, CompatStuff, "axis_1+2+3", "1+2+3", _line, _player, _ControllerName, False)
End If

If _line.StartsWith("I_BC_345=") Then '
DoAnnoyingFlycastStuff(CompatStuff, CompatStuff, CompatStuff, "axis_4+5+6", "4+5+6", _line, _player, _ControllerName, False)
End If

Else
Dim ToStickornotToStick = "CONT_"
If _Peripheral = "1" Then ToStickornotToStick = "STICK_"
Expand Down Expand Up @@ -1530,6 +1577,55 @@ Public Class frmKeyMapperSDL
DoAnnoyingFlycastStuff(CompatStuff, DreamcastStuff, EmulatorStuff, "axis_btn_c", "btn_c", _line, _player, _ControllerName, False)
End If

' Macros

'CONT_BC_ABC = k0|k0
'CONT_BC_XYZ = k0|k0
'CONT_BC_BC = k0|k0
'CONT_BC_AB = k0|k0
'CONT_BC_YZ = k0|k0
'CONT_BC_XY = k0|k0
'CONT_BC_CZ = k0|k0
'CONT_BC_YB = k0|k0
'CONT_BC_XA = k0|k0

If _line.StartsWith(ToStickornotToStick & "BC_XA=") Then ' btn_start
DoAnnoyingFlycastStuff(CompatStuff, CompatStuff, CompatStuff, "axis_X+A", "X+A", _line, _player, _ControllerName, False)
End If

If _line.StartsWith(ToStickornotToStick & "BC_YB=") Then ' btn_start
DoAnnoyingFlycastStuff(CompatStuff, CompatStuff, CompatStuff, "axis_Y+B", "Y+B", _line, _player, _ControllerName, False)
End If

If _line.StartsWith(ToStickornotToStick & "BC_CZ=") Then ' L/R
DoAnnoyingFlycastStuff(CompatStuff, CompatStuff, CompatStuff, "axis_L+R", "L+R", _line, _player, _ControllerName, False)
End If

If _line.StartsWith(ToStickornotToStick & "BC_XY=") Then ' btn_start
DoAnnoyingFlycastStuff(CompatStuff, CompatStuff, CompatStuff, "axis_X+Y", "X+Y", _line, _player, _ControllerName, False)
End If

If _line.StartsWith(ToStickornotToStick & "BC_YZ=") Then ' btn_start
DoAnnoyingFlycastStuff(CompatStuff, CompatStuff, CompatStuff, "axis_Y+L", "Y+L", _line, _player, _ControllerName, False)
End If

If _line.StartsWith(ToStickornotToStick & "BC_AB=") Then ' btn_start
DoAnnoyingFlycastStuff(CompatStuff, CompatStuff, CompatStuff, "axis_A+B", "A+B", _line, _player, _ControllerName, False)
End If

If _line.StartsWith(ToStickornotToStick & "BC_BC=") Then ' btn_start
DoAnnoyingFlycastStuff(CompatStuff, CompatStuff, CompatStuff, "axis_B+R", "B+R", _line, _player, _ControllerName, False)
End If

If _line.StartsWith(ToStickornotToStick & "BC_ABC=") Then ' btn_start
DoAnnoyingFlycastStuff(CompatStuff, CompatStuff, CompatStuff, "axis_A+B+R", "A+B+R", _line, _player, _ControllerName, False)
End If

If _line.StartsWith(ToStickornotToStick & "BC_XYZ=") Then ' btn_start
DoAnnoyingFlycastStuff(CompatStuff, CompatStuff, CompatStuff, "axis_X+Y+L", "X+Y+L", _line, _player, _ControllerName, False)
End If


End If

Next
Expand Down
6 changes: 4 additions & 2 deletions NullDC CvS2 BEAR/frmMain.vb
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ Imports System.Text
Imports System.Threading

Public Class frmMain
Public IsBeta As Boolean = True
Public IsBeta As Boolean = False

' Update Stuff
Dim UpdateCheckClient As New WebClient

Public Ver As String = "1.93f" 'Psst make sure to also change DreamcastGameOptimizations.txt
Public Ver As String = "1.94" 'Psst make sure to also change DreamcastGameOptimizations.txt

' Public InputHandler As InputHandling
Public NetworkHandler As NetworkHandling
Expand Down Expand Up @@ -91,9 +91,11 @@ Public Class frmMain
End If

End If

Catch ex As Exception
MsgBox("Couldn't change SDL version make sure nullDC is closed. Error: " & vbNewLine & ex.Message)
End

End Try
End Sub

Expand Down
43 changes: 42 additions & 1 deletion NullDC CvS2 BEAR/mFlycastLauncher.vb
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,36 @@ Public Class MFlycastLauncher
If MainformRef.ConfigFile.Vsync = 1 Then Vsync = "yes"
'FlycastInfo.Arguments += "-config config:rend.vsync=" & Vsync & " "

Dim CheckIfCreated As String() = {"GGPOAnalogAxes", "Stats"}
Dim InSection As String() = {"network", "network"}
Dim ValueDefault As String() = {"2", "yes"}
Dim WereCreated As Boolean() = {False, False}

ReDoConfigs:

'Some settings are locked some are not, these are not or maybe they're settings i know won't cause desync so i let people change
Dim lines() As String = File.ReadAllLines(MainformRef.NullDCPath & "\flycast\emu.cfg")

For Each line As String In lines
For i = 0 To CheckIfCreated.Count - 1
If line.StartsWith(CheckIfCreated(i)) Then WereCreated(i) = True
Next
Next

Dim linenumber = 0
For Each line As String In lines

For i = 0 To CheckIfCreated.Count - 1
If WereCreated(i) = False Then
If line.Trim = "[" & InSection(i) & "]" Then
lines(linenumber) = lines(linenumber) & vbNewLine & CheckIfCreated(i) & " = " & ValueDefault(i)
File.WriteAllLines(MainformRef.NullDCPath & "\flycast\emu.cfg", lines)
GoTo ReDoConfigs

End If
End If
Next

If line.StartsWith("rend.vsync = ") Then lines(linenumber) = "rend.vsync = " & Vsync

If line.StartsWith("device1 = ") Then lines(linenumber) = "device1 = 0"
Expand Down Expand Up @@ -97,15 +122,28 @@ Public Class MFlycastLauncher
'Dreamcast.SavestateSlot = 0
If line.StartsWith("Dreamcast.SavestateSlot = ") Then lines(linenumber) = "Dreamcast.SavestateSlot = 0"

If line.StartsWith("GGPOAnalogAxes = ") Then
Select Case romdetails(2)
Case "na", "fc_na", "fly_na"
lines(linenumber) = "GGPOAnalogAxes = 0"
Case Else
lines(linenumber) = "GGPOAnalogAxes = 2"
End Select

End If

If MainformRef.ConfigFile.Status = "Offline" Then
If line.StartsWith("GGPO = ") Then lines(linenumber) = "GGPO = no"
Else
If line.StartsWith("GGPO = ") Then lines(linenumber) = "GGPO = yes"

End If
linenumber += 1

linenumber += 1
Next

' Check if created stuff and if not then create them

File.WriteAllLines(MainformRef.NullDCPath & "\flycast\emu.cfg", lines)

' FlycastInfo.Arguments += "-config config:rend.DelayFrameSwapping=no "
Expand Down Expand Up @@ -143,6 +181,9 @@ Public Class MFlycastLauncher
If File.Exists(MainformRef.NullDCPath & "\dc\vmu_data_host.bin") Then
If romdetails(2) = "dc" Or romdetails(2) = "fly_dc" Then
FileSystem.FileCopy(MainformRef.NullDCPath & "\dc\vmu_data_host.bin", MainformRef.NullDCPath & "\flycast\data\vmu_save_A1.bin")
FlycastInfo.Arguments += "-config config:GGPOAnalogAxes=2 "
Else
FlycastInfo.Arguments += "-config config:GGPOAnalogAxes=0 "
End If
End If

Expand Down

0 comments on commit c1f7d03

Please sign in to comment.