Skip to content

Commit

Permalink
add romfs assets
Browse files Browse the repository at this point in the history
  • Loading branch information
TurtleP committed Mar 27, 2024
1 parent 3eb62d7 commit 4523137
Show file tree
Hide file tree
Showing 15 changed files with 157 additions and 0 deletions.
Binary file added platform/cafe/content/nogame/cartridge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added platform/cafe/content/nogame/nogame.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added platform/cafe/content/shaders/color.gsh
Binary file not shown.
Binary file added platform/cafe/content/shaders/texture.gsh
Binary file not shown.
29 changes: 29 additions & 0 deletions platform/ctr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,35 @@ target_include_directories(${PROJECT_NAME} PRIVATE
include
)

ctr_add_graphics_target(cartridge
IMAGE
OPTIONS -f rgba8888 -z auto
INPUTS "assets/nogame/cartridge.png"
)

ctr_add_graphics_target(nogame
IMAGE
OPTIONS -f rgba8888 -z auto
INPUTS "assets/nogame/nogame.png"
)

dkp_install_assets(${PROJECT_NAME}_ctr_romfs
DESTINATION "nogame"
TARGETS
cartridge
nogame
)

ctr_add_shader_library(main_v_pica
"assets/shaders/main.v.pica"
)

dkp_install_assets(${PROJECT_NAME}_ctr_romfs
DESTINATION "shaders"
TARGETS
main_v_pica
)

target_sources(${PROJECT_NAME} PRIVATE
source/boot.cpp
source/driver/EventQueue.cpp
Expand Down
Binary file added platform/ctr/assets/nogame/cartridge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added platform/ctr/assets/nogame/nogame.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 47 additions & 0 deletions platform/ctr/assets/shaders/main.v.pica
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
; Uniforms
.fvec projMtx[4]
.fvec mdlvMtx[4]

; Constants
.constf consts(1.0, 0.0, 0.0, 0.0)

.alias ones consts.xxxx
.alias zeros consts.yyyy

; Inputs
.in inPosition v0
.in inColor v1
.in inTexCoord v2

; Outputs
.out outPosition position
.out outColor color
.out outTexCoord0 texcoord0

; void main()
.proc main
; r0 = vec4(inPosition, 1.0)
mov r0.xyz, inPosition
mov r0.w, ones

; pos = mdlvMtx * inPosition;
dp4 r1.x, mdlvMtx[0], r0
dp4 r1.y, mdlvMtx[1], r0
dp4 r1.z, mdlvMtx[2], r0
dp4 r1.w, mdlvMtx[3], r0

; outPosition = projMtx * pos
dp4 outPosition.x, projMtx[0], r1
dp4 outPosition.y, projMtx[1], r1
dp4 outPosition.z, projMtx[2], r1
dp4 outPosition.w, projMtx[3], r1

; outTexCoord = inTexCoord
mov outTexCoord0, inTexCoord

; outColor = inColor
mov outColor, inColor

; We're finished
end
.end
4 changes: 4 additions & 0 deletions platform/ctr/source/boot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ namespace love
{
osSetSpeedupEnable(true);

romfsInit();

socBuffer = (uint32_t*)aligned_alloc(SOC_BUFFER_ALIGN, SOC_BUFFER_SIZE);
socInit(socBuffer, SOC_BUFFER_SIZE);

Expand All @@ -40,5 +42,7 @@ namespace love

if (socBuffer)
free(socBuffer);

romfsExit();
}
} // namespace love
Binary file added platform/hac/romfs/nogame/cartridge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added platform/hac/romfs/nogame/nogame.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions platform/hac/shaders/color_fsh.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#version 460

layout (location = 0) in vec4 inColor;
layout (location = 0) out vec4 outColor;

void main()
{
outColor = inColor;
}
13 changes: 13 additions & 0 deletions platform/hac/shaders/texture_fsh.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#version 460

layout (location = 0) in vec4 inColor;
layout (location = 1) in vec2 inTexCoord;

layout (location = 0) out vec4 outColor;

layout (binding = 0) uniform sampler2D texture0;

void main()
{
outColor = inColor * texture(texture0, inTexCoord);
}
23 changes: 23 additions & 0 deletions platform/hac/shaders/transform_vsh.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#version 460

layout (location = 0) in vec3 inPos;
layout (location = 1) in vec4 inColor;
layout (location = 2) in vec2 inTexCoord;

layout (location = 0) out vec4 outColor;
layout (location = 1) out vec2 outTexCoord;

layout (std140, binding = 0) uniform Transformation
{
mat4 mdlvMtx;
mat4 projMtx;
} u;

void main()
{
vec4 pos = u.mdlvMtx * vec4(inPos, 1.0);
gl_Position = u.projMtx * pos;

outColor = inColor;
outTexCoord = inTexCoord;
}
32 changes: 32 additions & 0 deletions platform/hac/shaders/video_fsh.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#version 460

layout (location = 0) in vec4 inColor;
layout (location = 1) in vec2 inTexCoord;

layout (location = 0) out vec4 outColor;

layout (binding = 0) uniform sampler2D video_y;
layout (binding = 1) uniform sampler2D video_cb;
layout (binding = 2) uniform sampler2D video_cr;

const vec3 yuv_add = vec3(-0.0627451017, -0.501960814, -0.501960814);

const vec3 yuv_r = vec3(1.164, 0.000, 1.596);
const vec3 yuv_g = vec3(1.164, -0.391, -0.813);
const vec3 yuv_b = vec3(1.164, 2.018, 0.000);

void main()
{
vec3 yuv;

yuv[0] = texture(video_y, inTexCoord).r;
yuv[1] = texture(video_cb, inTexCoord).r;
yuv[2] = texture(video_cr, inTexCoord).r;

yuv += yuv_add;

outColor[0] = dot(yuv, yuv_r);
outColor[1] = dot(yuv, yuv_g);
outColor[2] = dot(yuv, yuv_b);
outColor[3] = 1.0;
}

0 comments on commit 4523137

Please sign in to comment.