Skip to content

Commit e106b75

Browse files
committed
windows: fixed builds
1 parent 427dc74 commit e106b75

File tree

10 files changed

+28
-22
lines changed

10 files changed

+28
-22
lines changed

.appveyor.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ version: '{branch}-{build}'
33
clone_depth: 1
44

55
environment:
6-
PREMAKE_VERSION: 5.0.0-alpha13
7-
SDL_VERSION: 2.0.9
6+
PREMAKE_VERSION: 5.0.0-alpha14
7+
SDL_VERSION: 2.0.10
88
matrix:
99
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 Preview
10-
TOOLSET: vs2017
10+
TOOLSET: vs2019
1111
platform: x64
1212
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 Preview
13-
TOOLSET: vs2017
13+
TOOLSET: vs2019
1414
platform: Win32
1515
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
1616
TOOLSET: vs2017

premake5.lua

+8-2
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,16 @@ project "avocado"
205205
}
206206

207207
filter {"system:windows", "not options:headless", "platforms:x86"}
208-
libdirs "externals/SDL2/lib/x86"
208+
libdirs {
209+
"externals/SDL2/lib/x86",
210+
"externals/SDL2/VisualC/Win32/Release",
211+
}
209212

210213
filter {"system:windows", "not options:headless", "platforms:x64"}
211-
libdirs "externals/SDL2/lib/x64"
214+
libdirs {
215+
"externals/SDL2/lib/x64",
216+
"externals/SDL2/VisualC/x64/Release",
217+
}
212218

213219

214220
filter {"system:linux", "not options:headless"}

src/device/gpu/gpu.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#include <cassert>
33
#include <cstdio>
44
#include "config.h"
5-
#include "rectangle.h"
65
#include "render/render.h"
76
#include "utils/logic.h"
87
#include "utils/macros.h"
@@ -106,7 +105,7 @@ void GPU::drawPolygon(int16_t x[4], int16_t y[4], RGB c[4], TextureInfo t, bool
106105
}
107106
}
108107

109-
void GPU::drawRectangle(const Rectangle& rect) {
108+
void GPU::drawRectangle(const primitive::Rect& rect) {
110109
if (hardwareRendering) {
111110
int x[4], y[4];
112111
glm::ivec2 uv[4];
@@ -283,7 +282,7 @@ void GPU::cmdRectangle(RectangleArgs arg) {
283282
int16_t x = extend_sign<10>(arguments[1] & 0xffff);
284283
int16_t y = extend_sign<10>((arguments[1] & 0xffff0000) >> 16);
285284

286-
Rectangle rect;
285+
primitive::Rect rect;
287286
rect.pos = vec2(x, y);
288287
rect.size = vec2(w, h);
289288
rect.color = vec3((arguments[0]) & 0xff, (arguments[0] >> 8) & 0xff, (arguments[0] >> 16) & 0xff);

src/device/gpu/gpu.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
#include <array>
33
#include <glm/glm.hpp>
44
#include <vector>
5+
#include "primitive.h"
56
#include "psx_color.h"
67
#include "registers.h"
78

89
#define VRAM ((uint16_t(*)[VRAM_WIDTH])vram.data())
910

10-
struct Rectangle;
1111
struct System;
1212
class Render;
1313
class OpenGL;
@@ -108,7 +108,7 @@ class GPU {
108108
void cmdVramToVram(uint8_t command);
109109

110110
void drawPolygon(int16_t x[4], int16_t y[4], RGB c[4], TextureInfo t, bool isQuad = false, bool textured = false, int flags = 0);
111-
void drawRectangle(const Rectangle& rect);
111+
void drawRectangle(const primitive::Rect& rect);
112112

113113
void writeGP0(uint32_t data);
114114
void writeGP1(uint32_t data);

src/device/gpu/rectangle.h renamed to src/device/gpu/primitive.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#pragma once
22
#include <glm/glm.hpp>
33

4-
struct Rectangle {
4+
namespace primitive {
5+
struct Rect {
56
glm::ivec2 pos;
67
glm::ivec2 size;
78
glm::ivec3 color;
@@ -15,4 +16,5 @@ struct Rectangle {
1516
glm::ivec2 uv;
1617
glm::ivec2 texpage; // Texture page position in VRAM (from GP0_E1)
1718
glm::ivec2 clut; // Texture palette position in VRAM
18-
};
19+
};
20+
} // namespace primitives

src/device/gpu/render/render.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ class Render {
55
public:
66
static void drawLine(gpu::GPU* gpu, const int16_t x[2], const int16_t y[2], const RGB c[2]);
77
static void drawTriangle(gpu::GPU* gpu, gpu::Vertex v[3]);
8-
static void drawRectangle(gpu::GPU* gpu, const Rectangle& rect);
8+
static void drawRectangle(gpu::GPU* gpu, const primitive::Rect& rect);
99
};

src/device/gpu/render/render_rectangle.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "device/gpu/rectangle.h"
1+
#include "../primitive.h"
22
#include "render.h"
33
#include "texture_utils.h"
44
#include "utils/macros.h"
@@ -26,7 +26,7 @@ INLINE glm::uvec2 calculateTexel(glm::ivec2 tex, const gpu::GP0_E2 textureWindow
2626
}
2727

2828
template <ColorDepth bits>
29-
INLINE void rectangle(GPU* gpu, const Rectangle& rect) {
29+
INLINE void rectangle(GPU* gpu, const primitive::Rect& rect) {
3030
// Extract common GPU state
3131
using Transparency = gpu::GP0_E1::SemiTransparency;
3232
const auto transparency = gpu->gp0_e1.semiTransparency;
@@ -102,7 +102,7 @@ INLINE void rectangle(GPU* gpu, const Rectangle& rect) {
102102
}
103103
}
104104
}
105-
void Render::drawRectangle(gpu::GPU* gpu, const Rectangle& rect) {
105+
void Render::drawRectangle(gpu::GPU* gpu, const primitive::Rect& rect) {
106106
if (rect.bits == 0) {
107107
rectangle<ColorDepth::NONE>(gpu, rect);
108108
} else if (rect.bits == 4) {

src/device/spu/voice.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "voice.h"
2+
#include <cmath>
23
#include "sound/adpcm.h"
34
#include "utils/math.h"
45

@@ -61,7 +62,7 @@ void Voice::processEnvelope() {
6162
cycles *= 4;
6263
}
6364
if (e.direction == Dir::Decrease) {
64-
step = static_cast<int>(static_cast<float>(step) * std::ceil(static_cast<float>(adsrVolume._reg) / static_cast<float>(0x8000)));
65+
step = (int)(ceilf((float)adsrVolume._reg / (float)0x8000) * (float)step);
6566
}
6667
}
6768

src/renderer/opengl/opengl.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
#include "opengl.h"
22
#include <SDL.h>
33
#include <algorithm>
4-
#include "config.h"
5-
#include "device/gpu/gpu.h"
64
#define STB_IMAGE_WRITE_IMPLEMENTATION
75
#include <stb_image_write.h>
6+
#include "config.h"
87
#include "utils/string.h"
98

109
bool OpenGL::init() {

src/renderer/opengl/opengl.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
#pragma once
22
#include <opengl.h>
33
#include <memory>
4+
#include "device/gpu/gpu.h"
45
#include "shader/buffer.h"
56
#include "shader/framebuffer.h"
67
#include "shader/program.h"
78
#include "shader/texture.h"
89

9-
class gpu::GPU;
10-
1110
class OpenGL {
1211
public:
1312
#ifdef USE_OPENGLES

0 commit comments

Comments
 (0)