Skip to content

Commit

Permalink
fix issues after fork sync
Browse files Browse the repository at this point in the history
- disable Wii IR inputs for now, since the surrounding code has changes significantly
- don't use std::copysign to get it to compile on visual studio
- fully qualify header imports in python scripting project
- access emulated memory through `Core::System::GetInstance().GetMemory()`
- fix Scripting.vcxproj and Base.Dolphin.props after upstream restructurings
  • Loading branch information
Felk committed Jan 3, 2023
1 parent e0eada3 commit dc9c5ed
Show file tree
Hide file tree
Showing 21 changed files with 34 additions and 27 deletions.
6 changes: 4 additions & 2 deletions Source/Core/Core/API/Controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ void WiiIRManip::PerformInputManip(WiimoteCommon::DataReportBuilder& rpt, int co
}
const WiiInputIROverride& input_override = iter->second;

u8* const ir_data = rpt.GetIRDataPtr();
// u8* const ir_data = rpt.GetIRDataPtr();

using WiimoteEmu::CameraLogic;
u8 mode = CameraLogic::IR_MODE_BASIC;
Expand All @@ -121,7 +121,9 @@ void WiiIRManip::PerformInputManip(WiimoteCommon::DataReportBuilder& rpt, int co
Matrix44::FromQuaternion(Quaternion::RotateXYZ(ir_transform.pitch_yaw_roll)) *
Matrix44::Translate(ir_transform.position);
const Vec2 fov = {CameraLogic::CAMERA_FOV_X, CameraLogic::CAMERA_FOV_Y};
CameraLogic::WriteIRDataForTransform(ir_data, mode, fov, transform);
// TODO figure out how to hook this up again
// auto cam_points = CameraLogic::GetCameraPoints(transform, fov);
// m_camera_logic->Update(cam_points);
}

GCManip& GetGCManip()
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/API/Memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ void AddMemcheck(u32 addr)
TMemCheck memcheck;
memcheck.start_address = addr;
memcheck.end_address = addr;
PowerPC::memchecks.Add(memcheck);
PowerPC::memchecks.Add(std::move(memcheck));
}

void RemoveMemcheck(u32 addr)
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/HW/WiimoteEmu/Camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ void CameraLogic::Update(const std::array<CameraPoint, NUM_POINTS>& camera_point
if (!IOS::g_gpio_out[IOS::GPIO::SENSOR_BAR])
return;

switch (mode)
switch (m_reg_data.mode)
{
case IR_MODE_BASIC:
for (std::size_t i = 0; i != camera_points.size() / 2; ++i)
Expand Down
3 changes: 0 additions & 3 deletions Source/Core/Core/HW/WiimoteEmu/Camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,6 @@ class CameraLogic : public I2CSlave
static constexpr u8 I2C_ADDR = 0x58;
static constexpr int CAMERA_DATA_BYTES = 36;

static void WriteIRDataForTransform(u8* data, u8 mode, Common::Vec2 field_of_view,
const Common::Matrix44& transform);

private:
// TODO: some of this memory is write-only and should return error 7.
#pragma pack(push, 1)
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/Core/PowerPC/MMU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ u64 HostRead_U64(const u32 address)
{
auto& system = Core::System::GetInstance();
auto& memory = system.GetMemory();
return ReadFromHardware<XCheckTLBFlag::NoException, u64, TranslateCondition::Always>(address);
return ReadFromHardware<XCheckTLBFlag::NoException, u64, TranslateCondition::Always>(memory, address);
}

s8 HostRead_S8(const u32 address)
Expand All @@ -798,7 +798,7 @@ s32 HostRead_S32(const u32 address)

s64 HostRead_S64(const u32 address)
{
return static_cast<s64>(HostRead_U64(memory, address));
return static_cast<s64>(HostRead_U64(address));
}

float HostRead_F32(const u32 address)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ class ControlGroup
template <typename T>
static T ApplyDeadzone(T input, std::common_type_t<T> deadzone)
{
return std::copysign(std::max(T{0}, std::abs(input) - deadzone) / (T{1} - deadzone), input);
auto arg = std::max(T{0}, std::abs(input) - deadzone) / (T{1} - deadzone);
return input <= -0 ? -arg : arg;
//return std::copysign(arg, input); // TODO error C2039: '_copysign': is not a member of 'std'
}

const std::string name;
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Scripting/Python/Modules/controllermodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.

#include "controllermodule.h"
#include "Scripting/Python/Modules/controllermodule.h"

#include "Core/API/Controller.h"
#include "Common/Logging/Log.h"
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Scripting/Python/Modules/doliomodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.

#include "doliomodule.h"
#include "Scripting/Python/Modules/doliomodule.h"

#include <sstream>

Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Scripting/Python/Modules/dolphinmodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.

#include "dolphinmodule.h"
#include "Scripting/Python/Modules/dolphinmodule.h"

#include "Common/Logging/Log.h"
#include "Scripting/Python/Utils/module.h"
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Scripting/Python/Modules/eventmodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.

#include "eventmodule.h"
#include "Scripting/Python/Modules/eventmodule.h"

#include <deque>
#include <functional>
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Scripting/Python/Modules/guimodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.

#include "guimodule.h"
#include "Scripting/Python/Modules/guimodule.h"

#include "Common/Logging/Log.h"
#include "Core/API/Gui.h"
Expand Down
7 changes: 4 additions & 3 deletions Source/Core/Scripting/Python/Modules/memorymodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.

#include "memorymodule.h"
#include "Scripting/Python/Modules/memorymodule.h"

#include "Core/API/Memory.h"
#include "Core/HW/Memmap.h"
#include "Core/System.h"

#include "Scripting/Python/Utils/module.h"
#include "Scripting/Python/Utils/as_py_func.h"
Expand All @@ -24,7 +25,7 @@ static PyObject* Read(PyObject* self, PyObject* args)
{
// If Memory wasn't static, you'd get the memory instance from the state:
//MemoryModuleState* state = Py::GetState<MemoryModuleState>();
if (!Memory::IsInitialized())
if (!Core::System::GetInstance().GetMemory().IsInitialized())
{
PyErr_SetString(PyExc_ValueError, "memory is not initialized");
return nullptr;
Expand All @@ -42,7 +43,7 @@ static PyObject* Write(PyObject* self, PyObject* args)
{
// If Memory wasn't static, you'd get the memory instance from the state:
//MemoryModuleState* state = Py::GetState<MemoryModuleState>();
if (!Memory::IsInitialized())
if (!Core::System::GetInstance().GetMemory().IsInitialized())
{
PyErr_SetString(PyExc_ValueError, "memory is not initialized");
return nullptr;
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Scripting/Python/Modules/registersmodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.

#include "registersmodule.h"
#include "Scripting/Python/Modules/registersmodule.h"

#include "Core/API/Registers.h"

Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Scripting/Python/Modules/savestatemodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.

#include "savestatemodule.h"
#include "Scripting/Python/Modules/savestatemodule.h"

#include "Common/Logging/Log.h"
#include "Core/State.h"
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Scripting/Python/PyScriptingBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.

#include "PyScriptingBackend.h"
#include "Scripting/Python/PyScriptingBackend.h"

#include <Python.h>
#include <string>
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Scripting/Python/Utils/object_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.

#include "object_wrapper.h"
#include "Scripting/Python/Utils/object_wrapper.h"

namespace Py
{
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Scripting/Python/coroutine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.

#include "coroutine.h"
#include "Scripting/Python/coroutine.h"

#include <map>

Expand Down
5 changes: 4 additions & 1 deletion Source/Core/Scripting/Scripting.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VSPropsDir)Base.props" />
<Import Project="$(VSPropsDir)Base.Dolphin.props" />
<Import Project="$(VSPropsDir)PCHUse.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
Expand All @@ -21,6 +22,8 @@
<AdditionalIncludeDirectories>$(ExternalsDir)python\$(Platform)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>
<Import Project="$(ExternalsDir)imgui\exports.props" />
<Import Project="$(ExternalsDir)fmt\exports.props" />
<ItemGroup>
<ClCompile Include="Python\coroutine.cpp" />
<ClCompile Include="Python\Modules\controllermodule.cpp" />
Expand All @@ -44,7 +47,7 @@
<ClInclude Include="Python\Modules\guimodule.h" />
<ClInclude Include="Python\Modules\memorymodule.h" />
<ClInclude Include="Python\Modules\savestatemodule.h" />
<ClCompile Include="Python\Modules\registersmodule.h" />
<ClInclude Include="Python\Modules\registersmodule.h" />
<ClInclude Include="Python\PyScriptingBackend.h" />
<ClInclude Include="Python\Utils\as_py_func.h" />
<ClInclude Include="Python\Utils\convert.h" />
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/Scripting/Scripting.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@
<ClInclude Include="Python\Modules\controllermodule.h">
<Filter>Python\Modules</Filter>
</ClInclude>
<ClCompile Include="Python\Modules\registersmodule.h">
<ClInclude Include="Python\Modules\registersmodule.h">
<Filter>Python\Modules</Filter>
</ClCompile>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="Python">
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Scripting/ScriptingEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.

#include "ScriptingEngine.h"
#include "Scripting/ScriptingEngine.h"

#include "Core/API/Events.h"
#include "Core/API/Gui.h"
Expand Down
2 changes: 2 additions & 0 deletions Source/VSProps/Base.Dolphin.props
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@
<Link Condition="'$(ConfigurationType)'=='Application'">
<AdditionalDependencies>avrt.lib;comctl32.lib;iphlpapi.lib;ksuser.lib;setupapi.lib;shlwapi.lib;winmm.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies Condition="'$(Platform)'=='x64'">opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<!-- python -->
<AdditionalLibraryDirectories>$(ExternalsDir)python\$(Platform)\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<!--FFmpeg and the libs it pulls in-->
<AdditionalLibraryDirectories>$(ExternalsDir)FFmpeg-bin\$(Platform)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>avcodec.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib;bcrypt.lib;%(AdditionalDependencies)</AdditionalDependencies>
Expand Down

0 comments on commit dc9c5ed

Please sign in to comment.