diff --git a/platform/cafe/content/nogame/cartridge.png b/platform/cafe/content/nogame/cartridge.png new file mode 100644 index 00000000..cf0529bd Binary files /dev/null and b/platform/cafe/content/nogame/cartridge.png differ diff --git a/platform/cafe/content/nogame/nogame.png b/platform/cafe/content/nogame/nogame.png new file mode 100644 index 00000000..ed489235 Binary files /dev/null and b/platform/cafe/content/nogame/nogame.png differ diff --git a/platform/cafe/content/shaders/color.gsh b/platform/cafe/content/shaders/color.gsh new file mode 100644 index 00000000..edbc8688 Binary files /dev/null and b/platform/cafe/content/shaders/color.gsh differ diff --git a/platform/cafe/content/shaders/texture.gsh b/platform/cafe/content/shaders/texture.gsh new file mode 100644 index 00000000..88f915a6 Binary files /dev/null and b/platform/cafe/content/shaders/texture.gsh differ diff --git a/platform/ctr/CMakeLists.txt b/platform/ctr/CMakeLists.txt index f405a097..77236215 100644 --- a/platform/ctr/CMakeLists.txt +++ b/platform/ctr/CMakeLists.txt @@ -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 diff --git a/platform/ctr/assets/nogame/cartridge.png b/platform/ctr/assets/nogame/cartridge.png new file mode 100644 index 00000000..891ab70a Binary files /dev/null and b/platform/ctr/assets/nogame/cartridge.png differ diff --git a/platform/ctr/assets/nogame/nogame.png b/platform/ctr/assets/nogame/nogame.png new file mode 100644 index 00000000..e542b613 Binary files /dev/null and b/platform/ctr/assets/nogame/nogame.png differ diff --git a/platform/ctr/assets/shaders/main.v.pica b/platform/ctr/assets/shaders/main.v.pica new file mode 100644 index 00000000..89815251 --- /dev/null +++ b/platform/ctr/assets/shaders/main.v.pica @@ -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 diff --git a/platform/ctr/source/boot.cpp b/platform/ctr/source/boot.cpp index 99d3394b..a5702120 100644 --- a/platform/ctr/source/boot.cpp +++ b/platform/ctr/source/boot.cpp @@ -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); @@ -40,5 +42,7 @@ namespace love if (socBuffer) free(socBuffer); + + romfsExit(); } } // namespace love diff --git a/platform/hac/romfs/nogame/cartridge.png b/platform/hac/romfs/nogame/cartridge.png new file mode 100644 index 00000000..cf0529bd Binary files /dev/null and b/platform/hac/romfs/nogame/cartridge.png differ diff --git a/platform/hac/romfs/nogame/nogame.png b/platform/hac/romfs/nogame/nogame.png new file mode 100644 index 00000000..ed489235 Binary files /dev/null and b/platform/hac/romfs/nogame/nogame.png differ diff --git a/platform/hac/shaders/color_fsh.glsl b/platform/hac/shaders/color_fsh.glsl new file mode 100644 index 00000000..d391db09 --- /dev/null +++ b/platform/hac/shaders/color_fsh.glsl @@ -0,0 +1,9 @@ +#version 460 + +layout (location = 0) in vec4 inColor; +layout (location = 0) out vec4 outColor; + +void main() +{ + outColor = inColor; +} \ No newline at end of file diff --git a/platform/hac/shaders/texture_fsh.glsl b/platform/hac/shaders/texture_fsh.glsl new file mode 100644 index 00000000..0b4d3624 --- /dev/null +++ b/platform/hac/shaders/texture_fsh.glsl @@ -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); +} diff --git a/platform/hac/shaders/transform_vsh.glsl b/platform/hac/shaders/transform_vsh.glsl new file mode 100644 index 00000000..360c720e --- /dev/null +++ b/platform/hac/shaders/transform_vsh.glsl @@ -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; +} diff --git a/platform/hac/shaders/video_fsh.glsl b/platform/hac/shaders/video_fsh.glsl new file mode 100644 index 00000000..b05092e5 --- /dev/null +++ b/platform/hac/shaders/video_fsh.glsl @@ -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; +}