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

Another attempt to implement is_same_ptr() trait #9425

Merged
merged 3 commits into from
Dec 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Utilities/File.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "File.h"
#include "mutex.h"
#include "StrFmt.h"
#include "BEType.h"
#include "Crypto/sha1.h"

#include <unordered_map>
Expand Down
3 changes: 2 additions & 1 deletion Utilities/StrFmt.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#include "StrFmt.h"
#include "BEType.h"
#include "StrUtil.h"
#include "cfmt.h"
#include "util/endian.hpp"
#include "util/logs.hpp"
#include "util/v128.hpp"

#include <algorithm>
#include <string_view>
Expand Down
11 changes: 11 additions & 0 deletions Utilities/StrFmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,17 @@ struct fmt_unveil<b8, void>
}
};

template <typename T, bool Se, std::size_t Align>
struct fmt_unveil<se_t<T, Se, Align>, void>
{
using type = typename fmt_unveil<T>::type;

static inline auto get(const se_t<T, Se, Align>& arg)
{
return fmt_unveil<T>::get(arg);
}
};

// String type format provider, also type classifier (format() called if an argument is formatted as "%s")
template <typename T, typename = void>
struct fmt_class_string
Expand Down
4 changes: 2 additions & 2 deletions Utilities/Thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1296,7 +1296,7 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context) no

if (op != X64OP_LOAD_BE)
{
value = se_storage<u32>::swap(value);
value = stx::se_storage<u32>::swap(value);
}

if (op == X64OP_LOAD_CMP)
Expand Down Expand Up @@ -1338,7 +1338,7 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context) no
}

u32 val32 = static_cast<u32>(reg_value);
if (!thread->write_reg(addr, op == X64OP_STORE ? se_storage<u32>::swap(val32) : val32))
if (!thread->write_reg(addr, op == X64OP_STORE ? stx::se_storage<u32>::swap(val32) : val32))
{
return false;
}
Expand Down
3 changes: 3 additions & 0 deletions Utilities/bin_patch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
#include "version.h"
#include "Emu/System.h"

#include "util/types.hpp"
#include "util/endian.hpp"

LOG_CHANNEL(patch_log, "PAT");

namespace config_key
Expand Down
4 changes: 2 additions & 2 deletions Utilities/bin_patch.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#pragma once

#include "BEType.h"
#include <vector>
#include <string>
#include <unordered_map>

#include "util/types.hpp"
#include "util/yaml.hpp"

namespace patch_key
Expand Down Expand Up @@ -53,7 +53,7 @@ class patch_engine
f64 double_value;
} value { 0 };
};

using patch_app_versions = std::unordered_map<std::string /*app_version*/, bool /*enabled*/>;
using patch_serials = std::unordered_map<std::string /*serial*/, patch_app_versions>;
using patch_titles = std::unordered_map<std::string /*serial*/, patch_serials>;
Expand Down
2 changes: 2 additions & 0 deletions rpcs3/Crypto/unedat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include "Utilities/mutex.h"
#include <cmath>

#include "util/v128.hpp"

LOG_CHANNEL(edat_log, "EDAT");

// Static variables are being modified concurrently in ec.cpp, for now use a mutex
Expand Down
3 changes: 2 additions & 1 deletion rpcs3/Crypto/unedat.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

#include "utils.h"

#include "Utilities/BEType.h"
#include "Utilities/File.h"

#include "util/v128.hpp"

constexpr u32 SDAT_FLAG = 0x01000000;
constexpr u32 EDAT_COMPRESSED_FLAG = 0x00000001;
constexpr u32 EDAT_FLAG_0x02 = 0x00000002;
Expand Down
3 changes: 1 addition & 2 deletions rpcs3/Crypto/unpkg.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once

#include "Utilities/BEType.h"
#include <sstream>
#include <iomanip>

Expand Down Expand Up @@ -96,7 +95,7 @@ struct PKGExtHeader
be_t<u32> ext_hdr_size; // Extended header size. ex: 0x40
be_t<u32> ext_data_size; // ex: 0x180
be_t<u32> main_and_ext_headers_hmac_offset; // ex: 0x100
be_t<u32> metadata_header_hmac_offset; // ex: 0x360, 0x390, 0x490
be_t<u32> metadata_header_hmac_offset; // ex: 0x360, 0x390, 0x490
be_t<u64> tail_offset; // tail size seams to be always 0x1A0
be_t<u32> padding1;
be_t<u32> pkg_key_id; // Id of the AES key used for decryption. PSP = 0x1, PSVita = 0xC0000002, PSM = 0xC0000004
Expand Down
3 changes: 2 additions & 1 deletion rpcs3/Crypto/unself.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
#include "sha1.h"
#include "utils.h"
#include "unself.h"
#include "Utilities/BEType.h"
#include "Emu/VFS.h"
#include "Emu/System.h"

#include <algorithm>
#include <zlib.h>

#include "util/v128.hpp"

inline u8 Read8(const fs::file& f)
{
u8 ret;
Expand Down
3 changes: 2 additions & 1 deletion rpcs3/Emu/CPU/CPUTranslator.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

#include "util/types.hpp"
#include "Utilities/StrFmt.h"
#include "Utilities/BEType.h"
#include "Utilities/BitField.h"
#include "util/logs.hpp"
#include "Utilities/JIT.h"
Expand All @@ -38,6 +37,8 @@
#include <array>
#include <vector>

#include "util/v128.hpp"

enum class i2 : char
{
};
Expand Down
2 changes: 1 addition & 1 deletion rpcs3/Emu/Cell/Modules/cellAudio.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ struct audio_port
return addr.addr() + position(offset) * buf_size();
}

to_be_t<float>* get_vm_ptr(s32 offset = 0) const
be_t<f32>* get_vm_ptr(s32 offset = 0) const
{
return vm::_ptr<f32>(buf_addr(offset));
}
Expand Down
3 changes: 2 additions & 1 deletion rpcs3/Emu/Cell/Modules/cellAudioIn.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include "Utilities/BEType.h"
#include "util/types.hpp"
#include "util/endian.hpp"

// Error codes
enum CellAudioInError
Expand Down
2 changes: 0 additions & 2 deletions rpcs3/Emu/Cell/Modules/cellGem.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#pragma once

#include "Utilities/BEType.h"

static const float CELL_GEM_SPHERE_RADIUS_MM = 22.5f;

// Error codes
Expand Down
2 changes: 0 additions & 2 deletions rpcs3/Emu/Cell/Modules/cellJpgDec.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#pragma once

#include "Utilities/BEType.h"

//Return Codes
enum CellJpgDecError : u32
{
Expand Down
1 change: 0 additions & 1 deletion rpcs3/Emu/Cell/Modules/cellKb.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once

#include "Utilities/BEType.h"
#include "Emu/Io/Keyboard.h"

enum CellKbError : u32
Expand Down
1 change: 0 additions & 1 deletion rpcs3/Emu/Cell/Modules/cellMic.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once

#include "Utilities/BEType.h"
#include "Utilities/Thread.h"

#include "3rdparty/OpenAL/include/alext.h"
Expand Down
2 changes: 0 additions & 2 deletions rpcs3/Emu/Cell/Modules/cellMouse.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#pragma once

#include "Utilities/BEType.h"

enum CellMouseError : u32
{
CELL_MOUSE_ERROR_FATAL = 0x80121201,
Expand Down
1 change: 0 additions & 1 deletion rpcs3/Emu/Cell/Modules/cellPad.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once

#include "Utilities/BEType.h"
#include <array>

enum CellPadError : u32
Expand Down
2 changes: 0 additions & 2 deletions rpcs3/Emu/Cell/Modules/cellResc.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#pragma once

#include "Utilities/BEType.h"

enum CellRescError : u32
{
CELL_RESC_ERROR_NOT_INITIALIZED = 0x80210301,
Expand Down
1 change: 0 additions & 1 deletion rpcs3/Emu/Cell/Modules/cellRtc.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once

#include "Utilities/BEType.h"
#include "Emu/Memory/vm_ptr.h"
#include "Emu/Cell/ErrorCodes.h"

Expand Down
2 changes: 2 additions & 0 deletions rpcs3/Emu/Cell/Modules/cellSaveData.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include "stdafx.h"
#include <Emu/Memory/vm_ptr.h>

#include "util/v128.hpp"

// Return codes
enum CellSaveDataError : u32
{
Expand Down
2 changes: 2 additions & 0 deletions rpcs3/Emu/Cell/Modules/cellSpurs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#include "sysPrxForUser.h"
#include "cellSpurs.h"

#include "util/v128.hpp"

LOG_CHANNEL(cellSpurs);

template <>
Expand Down
2 changes: 1 addition & 1 deletion rpcs3/Emu/Cell/Modules/cellSpurs.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "cellSync.h"


#include "util/v128.hpp"

struct CellSpurs;
struct CellSpursTaskset;
Expand Down
2 changes: 2 additions & 0 deletions rpcs3/Emu/Cell/Modules/cellSpursSpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include <thread>
#include <mutex>

#include "util/v128.hpp"

LOG_CHANNEL(cellSpurs);

//----------------------------------------------------------------------------
Expand Down
2 changes: 0 additions & 2 deletions rpcs3/Emu/Cell/Modules/cellSubDisplay.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#pragma once

#include "Utilities/BEType.h"

// Return Codes
enum CellSubDisplayError : u32
{
Expand Down
2 changes: 0 additions & 2 deletions rpcs3/Emu/Cell/Modules/cellVdec.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#pragma once

#include "Utilities/BEType.h"

// Error Codes
enum CellVdecError : u32
{
Expand Down
2 changes: 0 additions & 2 deletions rpcs3/Emu/Cell/Modules/cellVpost.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ extern "C"
#pragma GCC diagnostic pop
#endif

#include "Utilities/BEType.h"

// Error Codes
enum CellVpostError : u32
{
Expand Down
2 changes: 0 additions & 2 deletions rpcs3/Emu/Cell/Modules/libsynth2.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#pragma once

#include "Utilities/BEType.h"

// Error Codes
enum CellSoundSynth2Error : u32
{
Expand Down
2 changes: 2 additions & 0 deletions rpcs3/Emu/Cell/Modules/sceNp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#include "Emu/NP/np_handler.h"
#include "Emu/NP/np_contexts.h"

#include "util/v128.hpp"

LOG_CHANNEL(sceNp);

template <>
Expand Down
2 changes: 0 additions & 2 deletions rpcs3/Emu/Cell/Modules/sceNp.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
#include "cellRtc.h"
#include "Emu/Cell/ErrorCodes.h"

#include "Utilities/BEType.h"

error_code sceNpInit(u32 poolsize, vm::ptr<void> poolptr);
error_code sceNpTerm();

Expand Down
2 changes: 0 additions & 2 deletions rpcs3/Emu/Cell/Modules/sceNpClans.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

#include "sceNp.h"

#include "Utilities/BEType.h"

// Return codes
enum SceNpClansError : u32
{
Expand Down
2 changes: 0 additions & 2 deletions rpcs3/Emu/Cell/Modules/sceNpCommerce2.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

#include "cellRtc.h"

#include "Utilities/BEType.h"

// Return codes
enum SceNpCommerce2Error
{
Expand Down
2 changes: 0 additions & 2 deletions rpcs3/Emu/Cell/Modules/sceNpTus.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#pragma once

#include "Utilities/BEType.h"

#include "cellRtc.h"
#include "sceNp.h"

Expand Down
3 changes: 2 additions & 1 deletion rpcs3/Emu/Cell/PPUAnalyser.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
#include <string>
#include <map>
#include <set>
#include "util/types.hpp"
#include "util/endian.hpp"

#include "Utilities/bit_set.h"
#include "Utilities/BEType.h"
#include "PPUOpcodes.h"

// PPU Function Attributes
Expand Down
2 changes: 2 additions & 0 deletions rpcs3/Emu/Cell/PPUCallback.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "Emu/Cell/PPUThread.h"

#include "util/v128.hpp"

struct ppu_func_opd_t;

namespace ppu_cb_detail
Expand Down
2 changes: 2 additions & 0 deletions rpcs3/Emu/Cell/PPUFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "PPUThread.h"

#include "util/v128.hpp"

using ppu_function_t = bool(*)(ppu_thread&);

// BIND_FUNC macro "converts" any appropriate HLE function to ppu_function_t, binding it to PPU thread context.
Expand Down
1 change: 1 addition & 0 deletions rpcs3/Emu/Cell/PPUInterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <cmath>

#include "util/asm.hpp"
#include "util/v128.hpp"

#if !defined(_MSC_VER) && defined(__clang__)
#pragma GCC diagnostic push
Expand Down
Loading