Skip to content

Commit

Permalink
DDGoController: Rewrite to support axis input
Browse files Browse the repository at this point in the history
And add virtual buttons for each of the possible states.
  • Loading branch information
stenzek committed Feb 12, 2025
1 parent a25d5dc commit 7bc18c8
Show file tree
Hide file tree
Showing 10 changed files with 532 additions and 40 deletions.
28 changes: 28 additions & 0 deletions data/resources/gamedb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36447,6 +36447,7 @@ SCPS-45166:
name: "Densha De Go! (aka Densha De Go! / Densya De Go! - Let's Go by Train!)"
controllers:
- DigitalController
- DDGoController
metadata:
publisher: "Taito"
developer: "Taito"
Expand All @@ -36465,6 +36466,7 @@ SCPS-45167:
name: "Densha De Go! (aka Densha De Go! / Densya De Go! - Let's Go by Train!)"
controllers:
- DigitalController
- DDGoController
metadata:
publisher: "Taito"
developer: "Taito"
Expand All @@ -36483,6 +36485,7 @@ SLPS-01150:
name: "Densha de Go! (Japan)"
controllers:
- DigitalController
- DDGoController
metadata:
publisher: "Taito"
developer: "Taito"
Expand All @@ -36499,12 +36502,16 @@ SLPS-01150:
linkCable: false
SLPM-80166:
name: "Densha de Go! (Japan) (Demo)"
controllers:
- DigitalController
- DDGoController
metadata:
genre: "** DEMO **"
SLPM-86263:
name: "Densha de Go! (Japan) (PlayStation the Best)"
controllers:
- DigitalController
- DDGoController
metadata:
publisher: "Taito"
developer: "Taito"
Expand All @@ -36524,6 +36531,7 @@ SLPM-86142:
controllers:
- AnalogController
- DigitalController
- DDGoController
metadata:
publisher: "Taito"
developer: "Taito"
Expand All @@ -36540,17 +36548,26 @@ SLPM-86142:
linkCable: false
SLPM-80346:
name: "Densha de Go! 2 (Japan) (Demo 1)"
controllers:
- AnalogController
- DigitalController
- DDGoController
metadata:
genre: "** DEMO **"
SLPM-80406:
name: "Densha de Go! 2 (Japan) (Demo 2)"
controllers:
- AnalogController
- DigitalController
- DDGoController
metadata:
genre: "** DEMO **"
SLPM-86615:
name: "Densha de Go! 2 (Japan) (Rev 1)"
controllers:
- AnalogController
- DigitalController
- DDGoController
metadata:
publisher: "Taito"
developer: "Taito"
Expand All @@ -36570,6 +36587,7 @@ SLPM-86141:
controllers:
- AnalogController
- DigitalController
- DDGoController
metadata:
publisher: "Taito"
developer: "Taito"
Expand All @@ -36589,6 +36607,7 @@ SLPM-86424:
controllers:
- AnalogController
- DigitalController
- DDGoController
metadata:
publisher: "Taito"
developer: "Taito"
Expand All @@ -36605,13 +36624,18 @@ SLPM-86424:
linkCable: false
SLPM-80521:
name: "Densha de Go! Nagoya Tetsudou-hen (Japan) (Demo)"
controllers:
- AnalogController
- DigitalController
- DDGoController
metadata:
genre: "** DEMO **"
SLPM-86378:
name: "Densha de Go! Professional Shiyou (Japan)"
controllers:
- AnalogController
- DigitalController
- DDGoController
codes:
- SLPM-86378
- SLPM-86705
Expand All @@ -36631,6 +36655,10 @@ SLPM-86378:
linkCable: false
SLPM-80511:
name: "Densha de Go! Professional Shiyou (Japan) (Taikenban)"
controllers:
- AnalogController
- DigitalController
- DDGoController
SCPS-18003:
name: "Depth (Japan)"
controllers:
Expand Down
4 changes: 4 additions & 0 deletions src/common/bitutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ ALWAYS_INLINE static constexpr u64 BoolToUInt64(bool value)
{
return static_cast<u64>(value);
}
ALWAYS_INLINE static constexpr float BoolToFloat(bool value)
{
return static_cast<float>(value);
}

// Integer to boolean
template<typename TValue>
Expand Down
2 changes: 2 additions & 0 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ add_library(core
cpu_pgxp.h
cpu_types.cpp
cpu_types.h
ddgo_controller.cpp
ddgo_controller.h
digital_controller.cpp
digital_controller.h
dma.cpp
Expand Down
9 changes: 6 additions & 3 deletions src/core/controller.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
// SPDX-FileCopyrightText: 2019-2025 Connor McLaughlin <stenzek@gmail.com>
// SPDX-License-Identifier: CC-BY-NC-ND-4.0

#include "controller.h"
#include "analog_controller.h"
#include "analog_joystick.h"
#include "ddgo_controller.h"
#include "digital_controller.h"
#include "game_database.h"
#include "guncon.h"
Expand Down Expand Up @@ -35,7 +36,7 @@ static constexpr std::array<const Controller::ControllerInfo*, static_cast<size_
&NeGconRumble::INFO,
&Justifier::INFO,
&DigitalController::INFO_POPN,
&DigitalController::INFO_DDGO,
&DDGoController::INFO,
&JogCon::INFO,
}};

Expand Down Expand Up @@ -120,7 +121,6 @@ std::unique_ptr<Controller> Controller::Create(ControllerType type, u32 index)
{
case ControllerType::DigitalController:
case ControllerType::PopnController:
case ControllerType::DDGoController:
return DigitalController::Create(index, type);

case ControllerType::AnalogController:
Expand All @@ -144,6 +144,9 @@ std::unique_ptr<Controller> Controller::Create(ControllerType type, u32 index)
case ControllerType::NeGconRumble:
return NeGconRumble::Create(index);

case ControllerType::DDGoController:
return DDGoController::Create(index);

case ControllerType::JogCon:
return JogCon::Create(index);

Expand Down
2 changes: 2 additions & 0 deletions src/core/core.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<ExcludedFromBuild Condition="'$(Platform)'!='x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="cpu_types.cpp" />
<ClCompile Include="ddgo_controller.cpp" />
<ClCompile Include="digital_controller.cpp" />
<ClCompile Include="fullscreen_ui.cpp" />
<ClCompile Include="game_database.cpp" />
Expand Down Expand Up @@ -108,6 +109,7 @@
<ClInclude Include="cpu_recompiler_x64.h">
<ExcludedFromBuild Condition="'$(Platform)'!='x64'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="ddgo_controller.h" />
<ClInclude Include="digital_controller.h" />
<ClInclude Include="fullscreen_ui.h" />
<ClInclude Include="game_database.h" />
Expand Down
2 changes: 2 additions & 0 deletions src/core/core.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
<ClCompile Include="pio.cpp" />
<ClCompile Include="gpu_thread.cpp" />
<ClCompile Include="gpu_presenter.cpp" />
<ClCompile Include="ddgo_controller.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="types.h" />
Expand Down Expand Up @@ -144,6 +145,7 @@
<ClInclude Include="gpu_thread.h" />
<ClInclude Include="gpu_thread_commands.h" />
<ClInclude Include="gpu_presenter.h" />
<ClInclude Include="ddgo_controller.h" />
</ItemGroup>
<ItemGroup>
<None Include="gpu_sw_rasterizer.inl" />
Expand Down
Loading

0 comments on commit 7bc18c8

Please sign in to comment.