summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2014-09-13 22:58:58 -0400
committerGravatar bunnei2014-09-13 22:58:58 -0400
commit5481115e71b1e8a35bce002926be3db6b91955a5 (patch)
tree99e1b34c33840c1316850eae1d44a6fdec9a7fd5 /src
parentMerge pull request #105 from kevinhartman/hid (diff)
parentrenderer_opengl.cpp: improved alignment for readability (diff)
downloadyuzu-5481115e71b1e8a35bce002926be3db6b91955a5.tar.gz
yuzu-5481115e71b1e8a35bce002926be3db6b91955a5.tar.xz
yuzu-5481115e71b1e8a35bce002926be3db6b91955a5.zip
Merge pull request #97 from archshift/cleanup
Small, general code cleanup
Diffstat (limited to 'src')
-rw-r--r--src/citra_qt/bootmanager.cpp5
-rw-r--r--src/core/arm/disassembler/load_symbol_map.cpp2
-rw-r--r--src/video_core/renderer_opengl/renderer_opengl.cpp32
-rw-r--r--src/video_core/utils.cpp32
-rw-r--r--src/video_core/utils.h2
-rw-r--r--src/video_core/video_core.cpp7
6 files changed, 32 insertions, 48 deletions
diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp
index 657e39bea..cf4d8b32b 100644
--- a/src/citra_qt/bootmanager.cpp
+++ b/src/citra_qt/bootmanager.cpp
@@ -19,9 +19,8 @@
19#define COPYRIGHT "Copyright (C) 2013-2014 Citra Team" 19#define COPYRIGHT "Copyright (C) 2013-2014 Citra Team"
20 20
21EmuThread::EmuThread(GRenderWindow* render_window) : 21EmuThread::EmuThread(GRenderWindow* render_window) :
22 exec_cpu_step(false), cpu_running(false), 22 filename(""), exec_cpu_step(false), cpu_running(false),
23 render_window(render_window), filename(""), 23 stop_run(false), render_window(render_window)
24 stop_run(false)
25{ 24{
26} 25}
27 26
diff --git a/src/core/arm/disassembler/load_symbol_map.cpp b/src/core/arm/disassembler/load_symbol_map.cpp
index f156c43ce..0f384ad3e 100644
--- a/src/core/arm/disassembler/load_symbol_map.cpp
+++ b/src/core/arm/disassembler/load_symbol_map.cpp
@@ -18,7 +18,7 @@ void LoadSymbolMap(std::string filename) {
18 std::ifstream infile(filename); 18 std::ifstream infile(filename);
19 19
20 std::string address_str, function_name, line; 20 std::string address_str, function_name, line;
21 u32 size, address; 21 u32 size;
22 22
23 while (std::getline(infile, line)) { 23 while (std::getline(infile, line)) {
24 std::istringstream iss(line); 24 std::istringstream iss(line);
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp
index ad3ce3ba1..bc1683cb5 100644
--- a/src/video_core/renderer_opengl/renderer_opengl.cpp
+++ b/src/video_core/renderer_opengl/renderer_opengl.cpp
@@ -18,28 +18,28 @@ static const GLfloat kViewportAspectRatio =
18 18
19// Fullscreen quad dimensions 19// Fullscreen quad dimensions
20static const GLfloat kTopScreenWidthNormalized = 2; 20static const GLfloat kTopScreenWidthNormalized = 2;
21static const GLfloat kTopScreenHeightNormalized = kTopScreenWidthNormalized * (static_cast<float>(VideoCore::kScreenTopHeight) / VideoCore::kScreenTopWidth); 21static const GLfloat kTopScreenHeightNormalized = kTopScreenWidthNormalized * (static_cast<float>(VideoCore::kScreenTopHeight) / VideoCore::kScreenTopWidth);
22static const GLfloat kBottomScreenWidthNormalized = kTopScreenWidthNormalized * (static_cast<float>(VideoCore::kScreenBottomWidth) / VideoCore::kScreenTopWidth); 22static const GLfloat kBottomScreenWidthNormalized = kTopScreenWidthNormalized * (static_cast<float>(VideoCore::kScreenBottomWidth) / VideoCore::kScreenTopWidth);
23static const GLfloat kBottomScreenHeightNormalized = kBottomScreenWidthNormalized * (static_cast<float>(VideoCore::kScreenBottomHeight) / VideoCore::kScreenBottomWidth); 23static const GLfloat kBottomScreenHeightNormalized = kBottomScreenWidthNormalized * (static_cast<float>(VideoCore::kScreenBottomHeight) / VideoCore::kScreenBottomWidth);
24 24
25static const GLfloat g_vbuffer_top[] = { 25static const GLfloat g_vbuffer_top[] = {
26 // x, y, z u, v 26 // x, y z u v
27 -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 27 -1.0f, 0.0f, 0.0f, 0.0f, 1.0f,
28 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 28 1.0f, 0.0f, 0.0f, 1.0f, 1.0f,
29 1.0f, kTopScreenHeightNormalized, 0.0f, 1.0f, 0.0f, 29 1.0f, kTopScreenHeightNormalized, 0.0f, 1.0f, 0.0f,
30 1.0f, kTopScreenHeightNormalized, 0.0f, 1.0f, 0.0f, 30 1.0f, kTopScreenHeightNormalized, 0.0f, 1.0f, 0.0f,
31 -1.0f, kTopScreenHeightNormalized, 0.0f, 0.0f, 0.0f, 31 -1.0f, kTopScreenHeightNormalized, 0.0f, 0.0f, 0.0f,
32 -1.0f, 0.0f, 0.0f, 0.0f, 1.0f 32 -1.0f, 0.0f, 0.0f, 0.0f, 1.0f
33}; 33};
34 34
35static const GLfloat g_vbuffer_bottom[] = { 35static const GLfloat g_vbuffer_bottom[] = {
36 // x, y, z u, v 36 // x y z u v
37 -(kBottomScreenWidthNormalized / 2), -kBottomScreenHeightNormalized, 0.0f, 0.0f, 1.0f, 37 -(kBottomScreenWidthNormalized / 2), -kBottomScreenHeightNormalized, 0.0f, 0.0f, 1.0f,
38 (kBottomScreenWidthNormalized / 2), -kBottomScreenHeightNormalized, 0.0f, 1.0f, 1.0f, 38 (kBottomScreenWidthNormalized / 2), -kBottomScreenHeightNormalized, 0.0f, 1.0f, 1.0f,
39 (kBottomScreenWidthNormalized / 2), 0.0f, 0.0f, 1.0f, 0.0f, 39 (kBottomScreenWidthNormalized / 2), 0.0f, 0.0f, 1.0f, 0.0f,
40 (kBottomScreenWidthNormalized / 2), 0.0f, 0.0f, 1.0f, 0.0f, 40 (kBottomScreenWidthNormalized / 2), 0.0f, 0.0f, 1.0f, 0.0f,
41 -(kBottomScreenWidthNormalized / 2), 0.0f, 0.0f, 0.0f, 0.0f, 41 -(kBottomScreenWidthNormalized / 2), 0.0f, 0.0f, 0.0f, 0.0f,
42 -(kBottomScreenWidthNormalized / 2), -kBottomScreenHeightNormalized, 0.0f, 0.0f, 1.0f 42 -(kBottomScreenWidthNormalized / 2), -kBottomScreenHeightNormalized, 0.0f, 0.0f, 1.0f
43}; 43};
44 44
45/// RendererOpenGL constructor 45/// RendererOpenGL constructor
diff --git a/src/video_core/utils.cpp b/src/video_core/utils.cpp
index b94376ac1..c1848f923 100644
--- a/src/video_core/utils.cpp
+++ b/src/video_core/utils.cpp
@@ -8,6 +8,7 @@
8#include "video_core/utils.h" 8#include "video_core/utils.h"
9 9
10namespace VideoCore { 10namespace VideoCore {
11
11/** 12/**
12 * Dumps a texture to TGA 13 * Dumps a texture to TGA
13 * @param filename String filename to dump texture to 14 * @param filename String filename to dump texture to
@@ -16,29 +17,20 @@ namespace VideoCore {
16 * @param raw_data Raw RGBA8 texture data to dump 17 * @param raw_data Raw RGBA8 texture data to dump
17 * @todo This should be moved to some general purpose/common code 18 * @todo This should be moved to some general purpose/common code
18 */ 19 */
19void DumpTGA(std::string filename, int width, int height, u8* raw_data) { 20void DumpTGA(std::string filename, short width, short height, u8* raw_data) {
20 TGAHeader hdr; 21 TGAHeader hdr = {0, 0, 2, 0, 0, 0, 0, width, height, 24, 0};
21 FILE* fout; 22 FILE* fout = fopen(filename.c_str(), "wb");
22 u8 r, g, b; 23
23
24 memset(&hdr, 0, sizeof(hdr));
25 hdr.datatypecode = 2; // uncompressed RGB
26 hdr.bitsperpixel = 24; // 24 bpp
27 hdr.width = width;
28 hdr.height = height;
29
30 fout = fopen(filename.c_str(), "wb");
31 fwrite(&hdr, sizeof(TGAHeader), 1, fout); 24 fwrite(&hdr, sizeof(TGAHeader), 1, fout);
32 for (int i = 0; i < height; i++) { 25
33 for (int j = 0; j < width; j++) { 26 for (int y = 0; y < height; y++) {
34 b = raw_data[(3 * (i * width)) + (3 * j) + 0]; 27 for (int x = 0; x < width; x++) {
35 g = raw_data[(3 * (i * width)) + (3 * j) + 1]; 28 putc(raw_data[(3 * (y * width)) + (3 * x) + 0], fout); // b
36 r = raw_data[(3 * (i * width)) + (3 * j) + 2]; 29 putc(raw_data[(3 * (y * width)) + (3 * x) + 1], fout); // g
37 putc(b, fout); 30 putc(raw_data[(3 * (y * width)) + (3 * x) + 2], fout); // r
38 putc(g, fout);
39 putc(r, fout);
40 } 31 }
41 } 32 }
33
42 fclose(fout); 34 fclose(fout);
43} 35}
44} // namespace 36} // namespace
diff --git a/src/video_core/utils.h b/src/video_core/utils.h
index 20d4ec9e0..9cb3d4d43 100644
--- a/src/video_core/utils.h
+++ b/src/video_core/utils.h
@@ -59,6 +59,6 @@ struct TGAHeader {
59 * @param raw_data Raw RGBA8 texture data to dump 59 * @param raw_data Raw RGBA8 texture data to dump
60 * @todo This should be moved to some general purpose/common code 60 * @todo This should be moved to some general purpose/common code
61 */ 61 */
62void DumpTGA(std::string filename, int width, int height, u8* raw_data); 62void DumpTGA(std::string filename, short width, short height, u8* raw_data);
63 63
64} // namespace 64} // namespace
diff --git a/src/video_core/video_core.cpp b/src/video_core/video_core.cpp
index 9aaff4917..c779771c5 100644
--- a/src/video_core/video_core.cpp
+++ b/src/video_core/video_core.cpp
@@ -21,13 +21,6 @@ EmuWindow* g_emu_window = NULL; ///< Frontend emulator window
21RendererBase* g_renderer = NULL; ///< Renderer plugin 21RendererBase* g_renderer = NULL; ///< Renderer plugin
22int g_current_frame = 0; 22int g_current_frame = 0;
23 23
24/// Start the video core
25void Start() {
26 if (g_emu_window == NULL) {
27 ERROR_LOG(VIDEO, "VideoCore::Start called without calling Init()!");
28 }
29}
30
31/// Initialize the video core 24/// Initialize the video core
32void Init(EmuWindow* emu_window) { 25void Init(EmuWindow* emu_window) {
33 g_emu_window = emu_window; 26 g_emu_window = emu_window;