aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/common/common_paths.h11
-rw-r--r--src/common/emu_window.h2
-rw-r--r--src/common/platform.h6
-rw-r--r--src/core/arm/arm_interface.h6
-rw-r--r--src/core/arm/dyncom/arm_dyncom.cpp5
-rw-r--r--src/core/arm/dyncom/arm_dyncom.h1
-rw-r--r--src/core/hle/service/hid/hid.cpp6
-rw-r--r--src/core/hle/svc.cpp5
-rw-r--r--src/core/hw/gpu.cpp19
-rw-r--r--src/core/hw/gpu.h2
-rw-r--r--src/core/loader/ncch.h25
-rw-r--r--src/video_core/color.h2
-rw-r--r--src/video_core/debug_utils/debug_utils.cpp6
-rw-r--r--src/video_core/vertex_shader.cpp44
14 files changed, 70 insertions, 70 deletions
diff --git a/src/common/common_paths.h b/src/common/common_paths.h
index eb43d589..440b0606 100644
--- a/src/common/common_paths.h
+++ b/src/common/common_paths.h
@@ -17,13 +17,12 @@
// The user data dir
#define ROOT_DIR "."
-#ifdef _WIN32
- #define USERDATA_DIR "user"
- #define EMU_DATA_DIR "Citra Emulator"
+#define USERDATA_DIR "user"
+#ifdef USER_DIR
+ #define EMU_DATA_DIR USER_DIR
#else
- #define USERDATA_DIR "user"
- #ifdef USER_DIR
- #define EMU_DATA_DIR USER_DIR
+ #ifdef _WIN32
+ #define EMU_DATA_DIR "Citra Emulator"
#else
#define EMU_DATA_DIR "citra-emu"
#endif
diff --git a/src/common/emu_window.h b/src/common/emu_window.h
index 2be7517b..c8e2de04 100644
--- a/src/common/emu_window.h
+++ b/src/common/emu_window.h
@@ -110,7 +110,7 @@ public:
* @return std::tuple of (x, y, pressed) where `x` and `y` are the touch coordinates and
* `pressed` is true if the touch screen is currently being pressed
*/
- const std::tuple<u16, u16, bool>& GetTouchState() const {
+ const std::tuple<u16, u16, bool> GetTouchState() const {
return std::make_tuple(touch_x, touch_y, touch_pressed);
}
diff --git a/src/common/platform.h b/src/common/platform.h
index ba1109c9..e27d6e31 100644
--- a/src/common/platform.h
+++ b/src/common/platform.h
@@ -83,7 +83,7 @@ inline struct tm* localtime_r(const time_t *clock, struct tm *result) {
}
#endif
-#else
+#else // EMU_PLATFORM != PLATFORM_WINDOWS
#define EMU_FASTCALL __attribute__((fastcall))
#define __stdcall
@@ -92,10 +92,6 @@ inline struct tm* localtime_r(const time_t *clock, struct tm *result) {
#define BOOL bool
#define DWORD u32
-#endif
-
-#if EMU_PLATFORM != PLATFORM_WINDOWS
-
// TODO: Hacks..
#include <limits.h>
diff --git a/src/core/arm/arm_interface.h b/src/core/arm/arm_interface.h
index ef37ee05..fe1e584a 100644
--- a/src/core/arm/arm_interface.h
+++ b/src/core/arm/arm_interface.h
@@ -74,12 +74,6 @@ public:
virtual void SetCPSR(u32 cpsr) = 0;
/**
- * Returns the number of clock ticks since the last rese
- * @return Returns number of clock ticks
- */
- virtual u64 GetTicks() const = 0;
-
- /**
* Advance the CPU core by the specified number of ticks (e.g. to simulate CPU execution time)
* @param ticks Number of ticks to advance the CPU core
*/
diff --git a/src/core/arm/dyncom/arm_dyncom.cpp b/src/core/arm/dyncom/arm_dyncom.cpp
index bbcbbdd2..cb1a410a 100644
--- a/src/core/arm/dyncom/arm_dyncom.cpp
+++ b/src/core/arm/dyncom/arm_dyncom.cpp
@@ -68,11 +68,6 @@ void ARM_DynCom::SetCPSR(u32 cpsr) {
state->Cpsr = cpsr;
}
-u64 ARM_DynCom::GetTicks() const {
- // TODO(Subv): Remove ARM_DynCom::GetTicks() and use CoreTiming::GetTicks() directly once ARMemu is gone
- return CoreTiming::GetTicks();
-}
-
void ARM_DynCom::AddTicks(u64 ticks) {
down_count -= ticks;
if (down_count < 0)
diff --git a/src/core/arm/dyncom/arm_dyncom.h b/src/core/arm/dyncom/arm_dyncom.h
index 213cac1a..a7f95d30 100644
--- a/src/core/arm/dyncom/arm_dyncom.h
+++ b/src/core/arm/dyncom/arm_dyncom.h
@@ -23,7 +23,6 @@ public:
u32 GetCPSR() const override;
void SetCPSR(u32 cpsr) override;
- u64 GetTicks() const override;
void AddTicks(u64 ticks) override;
void ResetContext(Core::ThreadContext& context, u32 stack_top, u32 entry_point, u32 arg);
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index 6a763fd5..138603d9 100644
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -7,7 +7,7 @@
#include "core/hle/service/hid/hid_spvr.h"
#include "core/hle/service/hid/hid_user.h"
-#include "core/arm/arm_interface.h"
+#include "core/core_timing.h"
#include "core/hle/kernel/event.h"
#include "core/hle/kernel/shared_memory.h"
#include "core/hle/hle.h"
@@ -82,7 +82,7 @@ void HIDUpdate() {
// If we just updated index 0, provide a new timestamp
if (mem->pad.index == 0) {
mem->pad.index_reset_ticks_previous = mem->pad.index_reset_ticks;
- mem->pad.index_reset_ticks = (s64)Core::g_app_core->GetTicks();
+ mem->pad.index_reset_ticks = (s64)CoreTiming::GetTicks();
}
mem->touch.index = next_touch_index;
@@ -102,7 +102,7 @@ void HIDUpdate() {
// If we just updated index 0, provide a new timestamp
if (mem->touch.index == 0) {
mem->touch.index_reset_ticks_previous = mem->touch.index_reset_ticks;
- mem->touch.index_reset_ticks = (s64)Core::g_app_core->GetTicks();
+ mem->touch.index_reset_ticks = (s64)CoreTiming::GetTicks();
}
// Signal both handles when there's an update to Pad or touch
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp
index 17385f9b..bbb4eb9c 100644
--- a/src/core/hle/svc.cpp
+++ b/src/core/hle/svc.cpp
@@ -7,8 +7,9 @@
#include "common/string_util.h"
#include "common/symbols.h"
-#include "core/arm/arm_interface.h"
+#include "core/core_timing.h"
#include "core/mem_map.h"
+#include "core/arm/arm_interface.h"
#include "core/hle/kernel/address_arbiter.h"
#include "core/hle/kernel/event.h"
@@ -551,7 +552,7 @@ static void SleepThread(s64 nanoseconds) {
/// This returns the total CPU ticks elapsed since the CPU was powered-on
static s64 GetSystemTick() {
- return (s64)Core::g_app_core->GetTicks();
+ return (s64)CoreTiming::GetTicks();
}
/// Creates a memory block at the specified address with the specified permissions and size
diff --git a/src/core/hw/gpu.cpp b/src/core/hw/gpu.cpp
index f933a5e8..07443616 100644
--- a/src/core/hw/gpu.cpp
+++ b/src/core/hw/gpu.cpp
@@ -146,8 +146,17 @@ inline void Write(u32 addr, const T data) {
for (u32 x = 0; x < output_width; ++x) {
Math::Vec4<u8> src_color = { 0, 0, 0, 0 };
- u32 scaled_x = x * horizontal_scale;
- u32 scaled_y = y * vertical_scale;
+ // Calculate the [x,y] position of the input image
+ // based on the current output position and the scale
+ u32 input_x = x * horizontal_scale;
+ u32 input_y = y * vertical_scale;
+
+ if (config.flip_vertically) {
+ // Flip the y value of the output data,
+ // we do this after calculating the [x,y] position of the input image
+ // to account for the scaling options.
+ y = output_height - y - 1;
+ }
u32 dst_bytes_per_pixel = GPU::Regs::BytesPerPixel(config.output_format);
u32 src_bytes_per_pixel = GPU::Regs::BytesPerPixel(config.input_format);
@@ -159,14 +168,14 @@ inline void Write(u32 addr, const T data) {
u32 coarse_y = y & ~7;
u32 stride = output_width * dst_bytes_per_pixel;
- src_offset = (scaled_x + scaled_y * config.input_width) * src_bytes_per_pixel;
+ src_offset = (input_x + input_y * config.input_width) * src_bytes_per_pixel;
dst_offset = VideoCore::GetMortonOffset(x, y, dst_bytes_per_pixel) + coarse_y * stride;
} else {
// Interpret the input as tiled and the output as linear
- u32 coarse_y = scaled_y & ~7;
+ u32 coarse_y = input_y & ~7;
u32 stride = config.input_width * src_bytes_per_pixel;
- src_offset = VideoCore::GetMortonOffset(scaled_x, scaled_y, src_bytes_per_pixel) + coarse_y * stride;
+ src_offset = VideoCore::GetMortonOffset(input_x, input_y, src_bytes_per_pixel) + coarse_y * stride;
dst_offset = (x + y * output_width) * dst_bytes_per_pixel;
}
diff --git a/src/core/hw/gpu.h b/src/core/hw/gpu.h
index 5b7f0a4e..e8552d85 100644
--- a/src/core/hw/gpu.h
+++ b/src/core/hw/gpu.h
@@ -191,7 +191,7 @@ struct Regs {
union {
u32 flags;
- BitField< 0, 1, u32> flip_data; // flips input data horizontally (TODO) if true
+ BitField< 0, 1, u32> flip_vertically; // flips input data vertically
BitField< 1, 1, u32> output_tiled; // Converts from linear to tiled format
BitField< 3, 1, u32> raw_copy; // Copies the data without performing any processing
BitField< 8, 3, PixelFormat> input_format;
diff --git a/src/core/loader/ncch.h b/src/core/loader/ncch.h
index 9ae2de99..f6f67006 100644
--- a/src/core/loader/ncch.h
+++ b/src/core/loader/ncch.h
@@ -20,8 +20,8 @@ struct NCCH_Header {
u16 version;
u8 reserved_0[4];
u8 program_id[8];
- u8 temp_flag;
- u8 reserved_1[0x2f];
+ u8 reserved_1[0x10];
+ u8 logo_region_hash[0x20];
u8 product_code[0x10];
u8 extended_header_hash[0x20];
u32 extended_header_size;
@@ -29,15 +29,16 @@ struct NCCH_Header {
u8 flags[8];
u32 plain_region_offset;
u32 plain_region_size;
- u8 reserved_3[8];
+ u32 logo_region_offset;
+ u32 logo_region_size;
u32 exefs_offset;
u32 exefs_size;
u32 exefs_hash_region_size;
- u8 reserved_4[4];
+ u8 reserved_3[4];
u32 romfs_offset;
u32 romfs_size;
u32 romfs_hash_region_size;
- u8 reserved_5[4];
+ u8 reserved_4[4];
u8 exefs_super_block_hash[0x20];
u8 romfs_super_block_hash[0x20];
};
@@ -88,8 +89,7 @@ struct ExHeader_DependencyList{
};
struct ExHeader_SystemInfo{
- u32 save_data_size;
- u8 reserved[4];
+ u64 save_data_size;
u8 jump_id[8];
u8 reserved_2[0x30];
};
@@ -104,11 +104,14 @@ struct ExHeader_StorageInfo{
struct ExHeader_ARM11_SystemLocalCaps{
u8 program_id[8];
- u8 flags[8];
- u8 resource_limit_descriptor[0x10][2];
+ u32 core_version;
+ u8 flags[3];
+ u8 priority;
+ u8 resource_limit_descriptor[0x16][2];
ExHeader_StorageInfo storage_info;
- u8 service_access_control[0x20][8];
- u8 reserved[0x1f];
+ u8 service_access_control[0x32][8];
+ u8 ex_service_access_control[0x2][8];
+ u8 reserved[0xf];
u8 resource_limit_category;
};
diff --git a/src/video_core/color.h b/src/video_core/color.h
index 14ade74f..43d635e2 100644
--- a/src/video_core/color.h
+++ b/src/video_core/color.h
@@ -124,7 +124,7 @@ inline u32 DecodeD24(const u8* bytes) {
* @return Resulting values stored as a Math::Vec2
*/
inline const Math::Vec2<u32> DecodeD24S8(const u8* bytes) {
- return { (bytes[2] << 16) | (bytes[1] << 8) | bytes[0], bytes[3] };
+ return { static_cast<u32>((bytes[2] << 16) | (bytes[1] << 8) | bytes[0]), bytes[3] };
}
/**
diff --git a/src/video_core/debug_utils/debug_utils.cpp b/src/video_core/debug_utils/debug_utils.cpp
index 745c4f4e..83982b4f 100644
--- a/src/video_core/debug_utils/debug_utils.cpp
+++ b/src/video_core/debug_utils/debug_utils.cpp
@@ -322,7 +322,7 @@ const Math::Vec4<u8> LookupTexture(const u8* source, int x, int y, const Texture
case Regs::TextureFormat::RGBA8:
{
auto res = Color::DecodeRGBA8(source + VideoCore::GetMortonOffset(x, y, 4));
- return { res.r(), res.g(), res.b(), disable_alpha ? 255 : res.a() };
+ return { res.r(), res.g(), res.b(), static_cast<u8>(disable_alpha ? 255 : res.a()) };
}
case Regs::TextureFormat::RGB8:
@@ -334,7 +334,7 @@ const Math::Vec4<u8> LookupTexture(const u8* source, int x, int y, const Texture
case Regs::TextureFormat::RGB5A1:
{
auto res = Color::DecodeRGB5A1(source + VideoCore::GetMortonOffset(x, y, 2));
- return { res.r(), res.g(), res.b(), disable_alpha ? 255 : res.a() };
+ return { res.r(), res.g(), res.b(), static_cast<u8>(disable_alpha ? 255 : res.a()) };
}
case Regs::TextureFormat::RGB565:
@@ -346,7 +346,7 @@ const Math::Vec4<u8> LookupTexture(const u8* source, int x, int y, const Texture
case Regs::TextureFormat::RGBA4:
{
auto res = Color::DecodeRGBA4(source + VideoCore::GetMortonOffset(x, y, 2));
- return { res.r(), res.g(), res.b(), disable_alpha ? 255 : res.a() };
+ return { res.r(), res.g(), res.b(), static_cast<u8>(disable_alpha ? 255 : res.a()) };
}
case Regs::TextureFormat::IA8:
diff --git a/src/video_core/vertex_shader.cpp b/src/video_core/vertex_shader.cpp
index 4eb3e743..e8d86517 100644
--- a/src/video_core/vertex_shader.cpp
+++ b/src/video_core/vertex_shader.cpp
@@ -72,7 +72,7 @@ struct VertexShaderState {
u32* program_counter;
const float24* input_register_table[16];
- float24* output_register_table[7*4];
+ Math::Vec4<float24> output_registers[16];
Math::Vec4<float24> temporary_registers[16];
bool conditional_code[2];
@@ -198,8 +198,7 @@ static void ProcessShaderCode(VertexShaderState& state) {
src2[3] = src2[3] * float24::FromFloat32(-1);
}
- float24* dest = (instr.common.dest.Value() < 0x08) ? state.output_register_table[4*instr.common.dest.Value().GetIndex()]
- : (instr.common.dest.Value() < 0x10) ? dummy_vec4_float24
+ float24* dest = (instr.common.dest.Value() < 0x10) ? &state.output_registers[instr.common.dest.Value().GetIndex()][0]
: (instr.common.dest.Value() < 0x20) ? &state.temporary_registers[instr.common.dest.Value().GetIndex()][0]
: dummy_vec4_float24;
@@ -409,8 +408,7 @@ static void ProcessShaderCode(VertexShaderState& state) {
src3[3] = src3[3] * float24::FromFloat32(-1);
}
- float24* dest = (instr.mad.dest.Value() < 0x08) ? state.output_register_table[4*instr.mad.dest.Value().GetIndex()]
- : (instr.mad.dest.Value() < 0x10) ? dummy_vec4_float24
+ float24* dest = (instr.mad.dest.Value() < 0x10) ? &state.output_registers[instr.mad.dest.Value().GetIndex()][0]
: (instr.mad.dest.Value() < 0x20) ? &state.temporary_registers[instr.mad.dest.Value().GetIndex()][0]
: dummy_vec4_float24;
@@ -587,12 +585,18 @@ OutputVertex RunShader(const InputVertex& input, int num_attributes) {
if(num_attributes > 14) state.input_register_table[attribute_register_map.attribute14_register] = &input.attr[14].x;
if(num_attributes > 15) state.input_register_table[attribute_register_map.attribute15_register] = &input.attr[15].x;
- // Setup output register table
- OutputVertex ret;
- // Zero output so that attributes which aren't output won't have denormals in them, which will
- // slow us down later.
- memset(&ret, 0, sizeof(ret));
+ state.conditional_code[0] = false;
+ state.conditional_code[1] = false;
+
+ ProcessShaderCode(state);
+ DebugUtils::DumpShader(shader_memory.data(), state.debug.max_offset, swizzle_data.data(),
+ state.debug.max_opdesc_id, registers.vs_main_offset,
+ registers.vs_output_attributes);
+ // Setup output data
+ OutputVertex ret;
+ // TODO(neobrain): Under some circumstances, up to 16 attributes may be output. We need to
+ // figure out what those circumstances are and enable the remaining outputs then.
for (int i = 0; i < 7; ++i) {
const auto& output_register_map = registers.vs_output_attributes[i];
@@ -601,18 +605,18 @@ OutputVertex RunShader(const InputVertex& input, int num_attributes) {
output_register_map.map_z, output_register_map.map_w
};
- for (int comp = 0; comp < 4; ++comp)
- state.output_register_table[4*i+comp] = ((float24*)&ret) + semantics[comp];
+ for (int comp = 0; comp < 4; ++comp) {
+ float24* out = ((float24*)&ret) + semantics[comp];
+ if (semantics[comp] != Regs::VSOutputAttributes::INVALID) {
+ *out = state.output_registers[i][comp];
+ } else {
+ // Zero output so that attributes which aren't output won't have denormals in them,
+ // which would slow us down later.
+ memset(out, 0, sizeof(*out));
+ }
+ }
}
- state.conditional_code[0] = false;
- state.conditional_code[1] = false;
-
- ProcessShaderCode(state);
- DebugUtils::DumpShader(shader_memory.data(), state.debug.max_offset, swizzle_data.data(),
- state.debug.max_opdesc_id, registers.vs_main_offset,
- registers.vs_output_attributes);
-
LOG_TRACE(Render_Software, "Output vertex: pos (%.2f, %.2f, %.2f, %.2f), col(%.2f, %.2f, %.2f, %.2f), tc0(%.2f, %.2f)",
ret.pos.x.ToFloat32(), ret.pos.y.ToFloat32(), ret.pos.z.ToFloat32(), ret.pos.w.ToFloat32(),
ret.color.x.ToFloat32(), ret.color.y.ToFloat32(), ret.color.z.ToFloat32(), ret.color.w.ToFloat32(),