Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preliminary HSP support #8067

Merged
merged 1 commit into from May 22, 2022
Merged

Preliminary HSP support #8067

merged 1 commit into from May 22, 2022

Conversation

endrift
Copy link
Contributor

@endrift endrift commented May 2, 2019

Repurposed for just HSP support for now, since merging that will be easier and I can get to GB Player when this interface is merged.

Source/Core/Core/HW/HSP/HSP_DeviceGBPlayer.cpp Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Outdated
if (_M_X86)
add_subdirectory(Externals/Bochs_disasm)
endif()
add_subdirectory(Externals/cpp-optparse)
add_subdirectory(Externals/glslang)
add_subdirectory(Externals/imgui)

set(DISABLE_FRONTENDS ON CACHE BOOL "" FORCE)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may want to consider making these qualified upstream in mGBA then modifying them here, (like MGBA_DISASBLE_DEPS), etc. These variables can now potentially leak into other dependencies. The build is essentially more fragile now.

Copy link
Member

@lioncash lioncash May 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should have added this during the initial review, but, this can be a lot to ask for a separate project. I mean, going, "lol just change ur build option flag names", isn't realistic in some scenarios, especially if the emulator is already being used as a lib elsewhere, since that'd be a minor forward-breaking change. Because of that, I definitely won't block on this or anything if that's too much of a chaotic change (hopefully it wasn't implied that I would on the initial review message 😅).

Pinging the CMake wiz @Orphis. Is there a nicer way to avoid this that doesn't involve upstream changes, or is that the only way in this scenario?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It depends on the extent of functionality that this option adds.
Possibly the best option would be to just use add_subdirectory(Externals/mgba EXCLUDE_FROM_ALL) without any special option. The final solution will have all the targets, but they won't be built unless they're actually used.

Source/Core/Core/HW/HSP/HSP_DeviceARAMExpansion.cpp Outdated Show resolved Hide resolved
Source/Core/Core/HW/HSP/HSP_DeviceARAMExpansion.cpp Outdated Show resolved Hide resolved
Source/Core/Core/HW/HSP/HSP_DeviceARAMExpansion.h Outdated Show resolved Hide resolved
Source/Core/Core/HW/HSP/HSP_DeviceGBPlayer.cpp Outdated Show resolved Hide resolved
Source/Core/Core/HW/HSP/HSP_DeviceGBPlayer.cpp Outdated Show resolved Hide resolved
Source/Core/Core/HW/HSP/HSP_DeviceGBPlayer.cpp Outdated Show resolved Hide resolved
Source/Core/Core/HW/HSP/HSP_DeviceGBPlayer.cpp Outdated Show resolved Hide resolved
Source/Core/Core/HW/HSP/HSP_DeviceGBPlayer.cpp Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Outdated
if (_M_X86)
add_subdirectory(Externals/Bochs_disasm)
endif()
add_subdirectory(Externals/cpp-optparse)
add_subdirectory(Externals/glslang)
add_subdirectory(Externals/imgui)

set(DISABLE_FRONTENDS ON CACHE BOOL "" FORCE)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It depends on the extent of functionality that this option adds.
Possibly the best option would be to just use add_subdirectory(Externals/mgba EXCLUDE_FROM_ALL) without any special option. The final solution will have all the targets, but they won't be built unless they're actually used.

CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
@endrift
Copy link
Contributor Author

endrift commented May 2, 2019

Will be fixing stuff upstream as needed, don't worry. I'm at lunch right now but I have a good chunk of this stuff resolved already. Will finish when I get home.

@endrift
Copy link
Contributor Author

endrift commented May 2, 2019

Might splitting out the base HSP changes from the GBP changes into separate PRs make sense? That was we can get the easy stuff merged first, not that it's actually useful without the GBP changes.

@endrift endrift force-pushed the hsp branch 6 times, most recently from 04afdef to 08bd121 Compare May 3, 2019 02:23
@endrift endrift force-pushed the hsp branch 4 times, most recently from 2df8c30 to 6164a5e Compare May 6, 2019 21:59
@leoetlino leoetlino marked this pull request as draft April 28, 2020 16:05
@endrift endrift changed the title [WIP] HSP and GB Player support [WIP] HSP support Mar 23, 2022
Source/Core/Core/HW/HSP/HSP_Device.h Outdated Show resolved Hide resolved
u64 CHSPDevice_ARAMExpansion::Read(u32 address)
{
u64 value;
std::memcpy(&value, &m_ptr[address & m_mask], sizeof(value));
return Common::swap64(value);
}

void CHSPDevice_ARAMExpansion::Write(u32 address, u64 value)
{
value = Common::swap64(value);
std::memcpy(&value, &m_ptr[address & m_mask], sizeof(value));
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the swapping here needed? Note that Memory::Read_U64/Write_U64 already performs a swap, and I see that similar swapping happens in DSP.cpp when changing s_ARAM. If it shouldn't be swapped at all then maybe Memory::Write_U64_Swap (and a currently-non-existent Read_U64_Swap) should be used instead. I guess this depends on how the gameboy player uses these values.

@Pokechu22
Copy link
Contributor

What happens if a DMA starts in-bounds for ARAM, but then goes out of bounds? Currently I think that would result in writing past the end of s_ARAM, but I assume it should instead start writing into HSP? (i.e. there should be one loop for while (s_arDMA.Cnt.count) instead of two based on if (s_arDMA.ARAddr < s_ARAM.size))

@JMC47
Copy link
Contributor

JMC47 commented Apr 13, 2022

Once the build issues + review comments are handled, I assume this is ready to merge?

@endrift
Copy link
Contributor Author

endrift commented May 21, 2022

I've fixed everything except the ARAM loop and swapping. Unsure how important those are at the moment but I can address them soon if desired.

@endrift endrift changed the title [WIP] HSP support Preliminary HSP support May 21, 2022
@endrift endrift marked this pull request as ready for review May 21, 2022 00:46
@endrift endrift requested a review from jordan-woyak May 21, 2022 00:50
Copy link
Contributor

@Pokechu22 Pokechu22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The swapping isn't too important - it's something that could be addressed in a later PR if it makes things easier there. The loop issue (#8067 (comment)) is also something that could be addressed in a later PR.

Source/Core/Core/HW/HSP/HSP.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@Pokechu22 Pokechu22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Things look generally good enough. I've got some minor include nitpicks and one naming change, but other than those everything looks good to me.

Source/Core/Core/HW/HSP/HSP.cpp Outdated Show resolved Hide resolved
Source/Core/Core/HW/HSP/HSP_DeviceARAMExpansion.cpp Outdated Show resolved Hide resolved
Source/Core/Core/HW/HSP/HSP_DeviceARAMExpansion.cpp Outdated Show resolved Hide resolved
Source/Core/Core/HW/HSP/HSP_DeviceARAMExpansion.cpp Outdated Show resolved Hide resolved
Source/Core/Core/HW/HSP/HSP_DeviceNull.cpp Outdated Show resolved Hide resolved
Source/Core/Core/HW/HSP/HSP_Device.h Outdated Show resolved Hide resolved
@Pokechu22 Pokechu22 dismissed jordan-woyak’s stale review May 21, 2022 22:24

Requested change has been resolved; there are other pending requested changes but they don't block merging

@JMC47
Copy link
Contributor

JMC47 commented May 22, 2022

@dolphin-emu-bot rebuild

@JMC47
Copy link
Contributor

JMC47 commented May 22, 2022

I don't want this to bitrot again, and it's got an approval. Good enough for me.

@JMC47 JMC47 merged commit 3a33574 into dolphin-emu:master May 22, 2022
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
9 participants