Verifying actual bytes read & More consistency

Added a if check in the read if it has actually read the amount of bytes, if it doesn't equal to size you send it will return false.

changed codebase to be more consistence through all files.

Added ReadChain function to memory.h
This commit is contained in:
Metick
2024-02-29 22:31:38 +01:00
parent 1146050894
commit 39a0e1e88b
8 changed files with 103 additions and 94 deletions

View File

@@ -38,9 +38,16 @@ int main()
mem.Write<int>(base + 0x66, 0x69);
std::cout << "Value: " << mem.Read<int>(base + 0x66) << std::endl;
int value = 0;
if (mem.Read(base + 0x66, &value, sizeof(value)))
std::cout << "Read Value" << std::endl;
else
std::cout << "Failed to read Value" << std::endl;
std::cout << "Value: " << value << std::endl;
auto handle = mem.CreateScatterHandle();
int value = 0;
value = 0;
mem.AddScatterReadRequest(handle, base + 0x66, &value, sizeof(value));
//You have to execute the read requests before you can read the values.
mem.ExecuteReadScatter(handle);