Compare commits
1 Commits
android-12
...
android-12
Author | SHA1 | Date | |
---|---|---|---|
bf99e05f33 |
@ -312,8 +312,6 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
||||
ViewUtils.showView(binding.surfaceInputOverlay)
|
||||
ViewUtils.hideView(binding.loadingIndicator)
|
||||
|
||||
emulationState.updateSurface()
|
||||
|
||||
// Setup overlay
|
||||
updateShowFpsOverlay()
|
||||
}
|
||||
@ -806,13 +804,6 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
||||
}
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun updateSurface() {
|
||||
if (surface != null) {
|
||||
NativeLibrary.surfaceChanged(surface)
|
||||
}
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun clearSurface() {
|
||||
if (surface == null) {
|
||||
|
@ -35,14 +35,13 @@ struct RomFSHeader {
|
||||
static_assert(sizeof(RomFSHeader) == 0x50, "RomFSHeader has incorrect size.");
|
||||
|
||||
struct DirectoryEntry {
|
||||
u32_le parent;
|
||||
u32_le sibling;
|
||||
u32_le child_dir;
|
||||
u32_le child_file;
|
||||
u32_le hash;
|
||||
u32_le name_length;
|
||||
};
|
||||
static_assert(sizeof(DirectoryEntry) == 0x18, "DirectoryEntry has incorrect size.");
|
||||
static_assert(sizeof(DirectoryEntry) == 0x14, "DirectoryEntry has incorrect size.");
|
||||
|
||||
struct FileEntry {
|
||||
u32_le parent;
|
||||
@ -65,22 +64,25 @@ std::pair<Entry, std::string> GetEntry(const VirtualFile& file, std::size_t offs
|
||||
return {entry, string};
|
||||
}
|
||||
|
||||
void ProcessFile(const VirtualFile& file, std::size_t file_offset, std::size_t data_offset,
|
||||
u32 this_file_offset, std::shared_ptr<VectorVfsDirectory>& parent) {
|
||||
while (this_file_offset != ROMFS_ENTRY_EMPTY) {
|
||||
void ProcessFile(VirtualFile file, std::size_t file_offset, std::size_t data_offset,
|
||||
u32 this_file_offset, std::shared_ptr<VectorVfsDirectory> parent) {
|
||||
while (true) {
|
||||
auto entry = GetEntry<FileEntry>(file, file_offset + this_file_offset);
|
||||
|
||||
parent->AddFile(std::make_shared<OffsetVfsFile>(
|
||||
file, entry.first.size, entry.first.offset + data_offset, entry.second));
|
||||
|
||||
if (entry.first.sibling == ROMFS_ENTRY_EMPTY)
|
||||
break;
|
||||
|
||||
this_file_offset = entry.first.sibling;
|
||||
}
|
||||
}
|
||||
|
||||
void ProcessDirectory(const VirtualFile& file, std::size_t dir_offset, std::size_t file_offset,
|
||||
void ProcessDirectory(VirtualFile file, std::size_t dir_offset, std::size_t file_offset,
|
||||
std::size_t data_offset, u32 this_dir_offset,
|
||||
std::shared_ptr<VectorVfsDirectory>& parent) {
|
||||
while (this_dir_offset != ROMFS_ENTRY_EMPTY) {
|
||||
std::shared_ptr<VectorVfsDirectory> parent) {
|
||||
while (true) {
|
||||
auto entry = GetEntry<DirectoryEntry>(file, dir_offset + this_dir_offset);
|
||||
auto current = std::make_shared<VectorVfsDirectory>(
|
||||
std::vector<VirtualFile>{}, std::vector<VirtualDir>{}, entry.second);
|
||||
@ -95,12 +97,14 @@ void ProcessDirectory(const VirtualFile& file, std::size_t dir_offset, std::size
|
||||
}
|
||||
|
||||
parent->AddDirectory(current);
|
||||
if (entry.first.sibling == ROMFS_ENTRY_EMPTY)
|
||||
break;
|
||||
this_dir_offset = entry.first.sibling;
|
||||
}
|
||||
}
|
||||
} // Anonymous namespace
|
||||
|
||||
VirtualDir ExtractRomFS(VirtualFile file) {
|
||||
VirtualDir ExtractRomFS(VirtualFile file, RomFSExtractionType type) {
|
||||
RomFSHeader header{};
|
||||
if (file->ReadObject(&header) != sizeof(RomFSHeader))
|
||||
return nullptr;
|
||||
@ -109,17 +113,27 @@ VirtualDir ExtractRomFS(VirtualFile file) {
|
||||
return nullptr;
|
||||
|
||||
const u64 file_offset = header.file_meta.offset;
|
||||
const u64 dir_offset = header.directory_meta.offset;
|
||||
const u64 dir_offset = header.directory_meta.offset + 4;
|
||||
|
||||
auto root_container = std::make_shared<VectorVfsDirectory>();
|
||||
auto root =
|
||||
std::make_shared<VectorVfsDirectory>(std::vector<VirtualFile>{}, std::vector<VirtualDir>{},
|
||||
file->GetName(), file->GetContainingDirectory());
|
||||
|
||||
ProcessDirectory(file, dir_offset, file_offset, header.data_offset, 0, root_container);
|
||||
ProcessDirectory(file, dir_offset, file_offset, header.data_offset, 0, root);
|
||||
|
||||
if (auto root = root_container->GetSubdirectory(""); root) {
|
||||
return std::make_shared<CachedVfsDirectory>(std::move(root));
|
||||
VirtualDir out = std::move(root);
|
||||
|
||||
if (type == RomFSExtractionType::SingleDiscard)
|
||||
return out->GetSubdirectories().front();
|
||||
|
||||
while (out->GetSubdirectories().size() == 1 && out->GetFiles().empty()) {
|
||||
if (Common::ToLower(out->GetSubdirectories().front()->GetName()) == "data" &&
|
||||
type == RomFSExtractionType::Truncated)
|
||||
break;
|
||||
out = out->GetSubdirectories().front();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return std::make_shared<CachedVfsDirectory>(std::move(out));
|
||||
}
|
||||
|
||||
VirtualFile CreateRomFS(VirtualDir dir, VirtualDir ext) {
|
||||
|
@ -7,9 +7,16 @@
|
||||
|
||||
namespace FileSys {
|
||||
|
||||
enum class RomFSExtractionType {
|
||||
Full, // Includes data directory
|
||||
Truncated, // Traverses into data directory
|
||||
SingleDiscard, // Traverses into the first subdirectory of root
|
||||
};
|
||||
|
||||
// Converts a RomFS binary blob to VFS Filesystem
|
||||
// Returns nullptr on failure
|
||||
VirtualDir ExtractRomFS(VirtualFile file);
|
||||
VirtualDir ExtractRomFS(VirtualFile file,
|
||||
RomFSExtractionType type = RomFSExtractionType::Truncated);
|
||||
|
||||
// Converts a VFS filesystem into a RomFS binary
|
||||
// Returns nullptr on failure
|
||||
|
@ -1091,30 +1091,30 @@ void EmulatedController::SetBattery(const Common::Input::CallbackStatus& callbac
|
||||
|
||||
bool is_charging = false;
|
||||
bool is_powered = false;
|
||||
NpadBatteryLevel battery_level = NpadBatteryLevel::Empty;
|
||||
NpadBatteryLevel battery_level = 0;
|
||||
switch (controller.battery_values[index]) {
|
||||
case Common::Input::BatteryLevel::Charging:
|
||||
is_charging = true;
|
||||
is_powered = true;
|
||||
battery_level = NpadBatteryLevel::Full;
|
||||
battery_level = 6;
|
||||
break;
|
||||
case Common::Input::BatteryLevel::Medium:
|
||||
battery_level = NpadBatteryLevel::High;
|
||||
battery_level = 6;
|
||||
break;
|
||||
case Common::Input::BatteryLevel::Low:
|
||||
battery_level = NpadBatteryLevel::Low;
|
||||
battery_level = 4;
|
||||
break;
|
||||
case Common::Input::BatteryLevel::Critical:
|
||||
battery_level = NpadBatteryLevel::Critical;
|
||||
battery_level = 2;
|
||||
break;
|
||||
case Common::Input::BatteryLevel::Empty:
|
||||
battery_level = NpadBatteryLevel::Empty;
|
||||
battery_level = 0;
|
||||
break;
|
||||
case Common::Input::BatteryLevel::None:
|
||||
case Common::Input::BatteryLevel::Full:
|
||||
default:
|
||||
is_powered = true;
|
||||
battery_level = NpadBatteryLevel::Full;
|
||||
battery_level = 8;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -302,15 +302,6 @@ enum class TouchScreenModeForNx : u8 {
|
||||
Heat2,
|
||||
};
|
||||
|
||||
// This is nn::hid::system::NpadBatteryLevel
|
||||
enum class NpadBatteryLevel : u32 {
|
||||
Empty,
|
||||
Critical,
|
||||
Low,
|
||||
High,
|
||||
Full,
|
||||
};
|
||||
|
||||
// This is nn::hid::NpadStyleTag
|
||||
struct NpadStyleTag {
|
||||
union {
|
||||
@ -394,12 +385,16 @@ struct NpadGcTriggerState {
|
||||
};
|
||||
static_assert(sizeof(NpadGcTriggerState) == 0x10, "NpadGcTriggerState is an invalid size");
|
||||
|
||||
// This is nn::hid::system::NpadBatteryLevel
|
||||
using NpadBatteryLevel = u32;
|
||||
static_assert(sizeof(NpadBatteryLevel) == 0x4, "NpadBatteryLevel is an invalid size");
|
||||
|
||||
// This is nn::hid::system::NpadPowerInfo
|
||||
struct NpadPowerInfo {
|
||||
bool is_powered{};
|
||||
bool is_charging{};
|
||||
INSERT_PADDING_BYTES(0x6);
|
||||
NpadBatteryLevel battery_level{NpadBatteryLevel::Full};
|
||||
NpadBatteryLevel battery_level{8};
|
||||
};
|
||||
static_assert(sizeof(NpadPowerInfo) == 0xC, "NpadPowerInfo is an invalid size");
|
||||
|
||||
|
@ -330,7 +330,8 @@ void WebBrowser::ExtractOfflineRomFS() {
|
||||
LOG_DEBUG(Service_AM, "Extracting RomFS to {}",
|
||||
Common::FS::PathToUTF8String(offline_cache_dir));
|
||||
|
||||
const auto extracted_romfs_dir = FileSys::ExtractRomFS(offline_romfs);
|
||||
const auto extracted_romfs_dir =
|
||||
FileSys::ExtractRomFS(offline_romfs, FileSys::RomFSExtractionType::SingleDiscard);
|
||||
|
||||
const auto temp_dir = system.GetFilesystem()->CreateDirectory(
|
||||
Common::FS::PathToUTF8String(offline_cache_dir), FileSys::Mode::ReadWrite);
|
||||
|
@ -1108,9 +1108,9 @@ Result Controller_NPad::DisconnectNpad(Core::HID::NpadIdType npad_id) {
|
||||
shared_memory->sixaxis_dual_right_properties.raw = 0;
|
||||
shared_memory->sixaxis_left_properties.raw = 0;
|
||||
shared_memory->sixaxis_right_properties.raw = 0;
|
||||
shared_memory->battery_level_dual = Core::HID::NpadBatteryLevel::Empty;
|
||||
shared_memory->battery_level_left = Core::HID::NpadBatteryLevel::Empty;
|
||||
shared_memory->battery_level_right = Core::HID::NpadBatteryLevel::Empty;
|
||||
shared_memory->battery_level_dual = 0;
|
||||
shared_memory->battery_level_left = 0;
|
||||
shared_memory->battery_level_right = 0;
|
||||
shared_memory->fullkey_color = {
|
||||
.attribute = ColorAttribute::NoController,
|
||||
.fullkey = {},
|
||||
|
@ -32,15 +32,15 @@ struct Lifo {
|
||||
}
|
||||
|
||||
std::size_t GetPreviousEntryIndex() const {
|
||||
return static_cast<size_t>((buffer_tail + max_buffer_size - 1) % max_buffer_size);
|
||||
return static_cast<size_t>((buffer_tail + total_buffer_count - 1) % total_buffer_count);
|
||||
}
|
||||
|
||||
std::size_t GetNextEntryIndex() const {
|
||||
return static_cast<size_t>((buffer_tail + 1) % max_buffer_size);
|
||||
return static_cast<size_t>((buffer_tail + 1) % total_buffer_count);
|
||||
}
|
||||
|
||||
void WriteNextEntry(const State& new_state) {
|
||||
if (buffer_count < static_cast<s64>(max_buffer_size) - 1) {
|
||||
if (buffer_count < total_buffer_count - 1) {
|
||||
buffer_count++;
|
||||
}
|
||||
buffer_tail = GetNextEntryIndex();
|
||||
|
@ -923,13 +923,9 @@ void RasterizerVulkan::UpdateDynamicStates() {
|
||||
}
|
||||
|
||||
void RasterizerVulkan::HandleTransformFeedback() {
|
||||
static std::once_flag warn_unsupported;
|
||||
|
||||
const auto& regs = maxwell3d->regs;
|
||||
if (!device.IsExtTransformFeedbackSupported()) {
|
||||
std::call_once(warn_unsupported, [&] {
|
||||
LOG_ERROR(Render_Vulkan, "Transform feedbacks used but not supported");
|
||||
});
|
||||
LOG_ERROR(Render_Vulkan, "Transform feedbacks used but not supported");
|
||||
return;
|
||||
}
|
||||
query_cache.CounterEnable(VideoCommon::QueryType::StreamingByteCount,
|
||||
|
@ -2737,7 +2737,7 @@ void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_pa
|
||||
return;
|
||||
}
|
||||
|
||||
const auto extracted = FileSys::ExtractRomFS(romfs);
|
||||
const auto extracted = FileSys::ExtractRomFS(romfs, FileSys::RomFSExtractionType::Full);
|
||||
if (extracted == nullptr) {
|
||||
failed();
|
||||
return;
|
||||
|
Reference in New Issue
Block a user