You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(35) |
Dec
(2) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(37) |
Feb
(10) |
Mar
|
Apr
(2) |
May
(17) |
Jun
(1) |
Jul
(14) |
Aug
(14) |
Sep
(4) |
Oct
|
Nov
(14) |
Dec
(4) |
2005 |
Jan
(6) |
Feb
|
Mar
|
Apr
(6) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
(92) |
Dec
(12) |
2006 |
Jan
(3) |
Feb
(4) |
Mar
|
Apr
(5) |
May
(3) |
Jun
(15) |
Jul
(3) |
Aug
(1) |
Sep
(29) |
Oct
(1) |
Nov
(6) |
Dec
(5) |
2007 |
Jan
(2) |
Feb
(2) |
Mar
|
Apr
(3) |
May
(14) |
Jun
(2) |
Jul
(16) |
Aug
(73) |
Sep
(12) |
Oct
(9) |
Nov
(27) |
Dec
(3) |
2008 |
Jan
(4) |
Feb
(4) |
Mar
(3) |
Apr
(8) |
May
(23) |
Jun
(4) |
Jul
(1) |
Aug
(3) |
Sep
(7) |
Oct
(5) |
Nov
(1) |
Dec
(1) |
2009 |
Jan
|
Feb
(10) |
Mar
|
Apr
(4) |
May
(4) |
Jun
(10) |
Jul
|
Aug
(1) |
Sep
|
Oct
(7) |
Nov
|
Dec
(1) |
2010 |
Jan
|
Feb
(1) |
Mar
|
Apr
(6) |
May
|
Jun
(3) |
Jul
(11) |
Aug
(1) |
Sep
|
Oct
(15) |
Nov
(1) |
Dec
(5) |
2011 |
Jan
(4) |
Feb
(1) |
Mar
(6) |
Apr
|
May
(22) |
Jun
|
Jul
(8) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
2012 |
Jan
|
Feb
(10) |
Mar
(1) |
Apr
(6) |
May
(27) |
Jun
(48) |
Jul
(30) |
Aug
(4) |
Sep
|
Oct
(3) |
Nov
(1) |
Dec
(11) |
2013 |
Jan
(4) |
Feb
(7) |
Mar
(6) |
Apr
(18) |
May
(28) |
Jun
(20) |
Jul
|
Aug
(4) |
Sep
(1) |
Oct
(1) |
Nov
(2) |
Dec
(7) |
2014 |
Jan
(3) |
Feb
(2) |
Mar
(4) |
Apr
(9) |
May
(11) |
Jun
(10) |
Jul
|
Aug
(18) |
Sep
(12) |
Oct
(17) |
Nov
(10) |
Dec
(16) |
2015 |
Jan
(5) |
Feb
(1) |
Mar
(5) |
Apr
(4) |
May
(28) |
Jun
(2) |
Jul
|
Aug
|
Sep
(6) |
Oct
|
Nov
(2) |
Dec
(1) |
2016 |
Jan
(14) |
Feb
|
Mar
(3) |
Apr
|
May
|
Jun
(3) |
Jul
(4) |
Aug
(4) |
Sep
(1) |
Oct
(1) |
Nov
|
Dec
(1) |
2017 |
Jan
(11) |
Feb
|
Mar
(21) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
(2) |
Sep
(4) |
Oct
(4) |
Nov
|
Dec
(1) |
2019 |
Jan
(1) |
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
(13) |
Sep
(4) |
Oct
|
Nov
|
Dec
|
2020 |
Jan
(10) |
Feb
(9) |
Mar
(5) |
Apr
(4) |
May
(3) |
Jun
(18) |
Jul
(4) |
Aug
(2) |
Sep
(20) |
Oct
(2) |
Nov
|
Dec
|
2021 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(1) |
Jun
(2) |
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
2022 |
Jan
(1) |
Feb
(2) |
Mar
(2) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
(5) |
Sep
|
Oct
(1) |
Nov
|
Dec
(1) |
2023 |
Jan
(10) |
Feb
(7) |
Mar
(29) |
Apr
(31) |
May
(29) |
Jun
(34) |
Jul
(3) |
Aug
(24) |
Sep
(22) |
Oct
(10) |
Nov
(38) |
Dec
(27) |
2024 |
Jan
(15) |
Feb
(8) |
Mar
(4) |
Apr
(20) |
May
(33) |
Jun
(18) |
Jul
(15) |
Aug
(23) |
Sep
(26) |
Oct
(32) |
Nov
(6) |
Dec
(4) |
2025 |
Jan
(7) |
Feb
(1) |
Mar
(1) |
Apr
(4) |
May
(46) |
Jun
(19) |
Jul
(26) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
From: PH3NOM <ph...@us...> - 2015-09-09 18:26:16
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The KallistiOS port of OpenGL.". The branch, master has been updated via 3df4244bc24235629621e4c9281d135ed5e281d8 (commit) from 46ed1d5353edae37064e3154d4ad8e5ee4bae2bc (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 3df4244bc24235629621e4c9281d135ed5e281d8 Author: Josh Pearson <ph...@us...> Date: Wed Sep 9 11:25:51 2015 -0700 Formatting cleanup, and cleanup on gl-fog.c ----------------------------------------------------------------------- Summary of changes: gl-api.c | 32 ++++------- gl-arrays.c | 47 +++++++--------- gl-cap.c | 28 +++++----- gl-fog.c | 79 ++++++++++++--------------- gl-light.c | 6 +- gl-matrix.c | 8 ++-- gl-pvr.c | 10 ++-- gl-rgb.c | 168 +++++++++++++++++++++++++--------------------------------- gl-rgb.h | 4 +- gl-texture.c | 71 ++++++++++++------------- 10 files changed, 201 insertions(+), 252 deletions(-) diff --git a/gl-api.c b/gl-api.c index dedfa6b..0f54352 100755 --- a/gl-api.c +++ b/gl-api.c @@ -267,27 +267,25 @@ void APIENTRY glColor4fv(const GLfloat *rgba) { //== Texture Coordinate Submission ==// void APIENTRY glTexCoord2f(GLfloat u, GLfloat v) { - if(_glKosEnabledTextureMatrix()) - { + if(_glKosEnabledTextureMatrix()) { _glKosMatrixLoadTexture(); mat_trans_texture2_nomod(u, v, GL_KOS_VERTEX_UV[0], GL_KOS_VERTEX_UV[1]); - + _glKosMatrixLoadRender(); } else { GL_KOS_VERTEX_UV[0] = u; GL_KOS_VERTEX_UV[1] = v; - } + } } void APIENTRY glTexCoord2fv(const GLfloat *uv) { - if(_glKosEnabledTextureMatrix()) - { + if(_glKosEnabledTextureMatrix()) { _glKosMatrixLoadTexture(); - + mat_trans_texture2_nomod(uv[0], uv[1], GL_KOS_VERTEX_UV[0], GL_KOS_VERTEX_UV[1]); - + _glKosMatrixLoadRender(); } else { @@ -946,32 +944,26 @@ GLuint _glKosVertexColor() { return GL_KOS_VERTEX_COLOR; } -void glAlphaFunc(GLenum func, GLclampf ref) -{ +void glAlphaFunc(GLenum func, GLclampf ref) { ; } -void glLineWidth(GLfloat width) -{ +void glLineWidth(GLfloat width) { ; } -void glPolygonOffset(GLfloat factor, GLfloat units) -{ +void glPolygonOffset(GLfloat factor, GLfloat units) { ; } -void glGetTexParameteriv(GLenum target, GLenum pname, GLint * params) -{ +void glGetTexParameteriv(GLenum target, GLenum pname, GLint *params) { ; } -void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) -{ +void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) { ; } -void glPixelStorei(GLenum pname, GLint param) -{ +void glPixelStorei(GLenum pname, GLint param) { ; } diff --git a/gl-arrays.c b/gl-arrays.c index 3deee29..7a4cbe4 100755 --- a/gl-arrays.c +++ b/gl-arrays.c @@ -461,18 +461,16 @@ static inline void _glKosElementTexCoord2fU16(pvr_vertex_t *dst, GLuint count) { GLuint i, index; GLfloat *t = GL_KOS_TEXCOORD0_POINTER; - if(_glKosEnabledTextureMatrix()) - { + if(_glKosEnabledTextureMatrix()) { _glKosMatrixLoadTexture(); - - for(i = 0; i < count; i++) - { + + for(i = 0; i < count; i++) { index = GL_KOS_INDEX_POINTER_U16[i] * GL_KOS_TEXCOORD0_STRIDE; - + mat_trans_texture2_nomod(t[index], t[index + 1], dst[i].u, dst[i].v); } - - _glKosMatrixLoadRender(); + + _glKosMatrixLoadRender(); } else { for(i = 0; i < count; i++) { @@ -487,18 +485,16 @@ static inline void _glKosElementTexCoord2fU8(pvr_vertex_t *dst, GLuint count) { GLuint i, index; GLfloat *t = GL_KOS_TEXCOORD0_POINTER; - if(_glKosEnabledTextureMatrix()) - { + if(_glKosEnabledTextureMatrix()) { _glKosMatrixLoadTexture(); - - for(i = 0; i < count; i++) - { + + for(i = 0; i < count; i++) { index = GL_KOS_INDEX_POINTER_U8[i] * GL_KOS_TEXCOORD0_STRIDE; - + mat_trans_texture2_nomod(t[index], t[index + 1], dst[i].u, dst[i].v); } - - _glKosMatrixLoadRender(); + + _glKosMatrixLoadRender(); } else { for(i = 0; i < count; i++) { @@ -1050,22 +1046,19 @@ static inline void _glKosArrayColor4f(pvr_vertex_t *dst, GLuint count) { static inline void _glKosArrayTexCoord2f(pvr_vertex_t *dst, GLuint count) { GLuint i; GLfloat *uv = GL_KOS_TEXCOORD0_POINTER; - - if(_glKosEnabledTextureMatrix()) - { + + if(_glKosEnabledTextureMatrix()) { _glKosMatrixLoadTexture(); - - for(i = 0; i < count; i++) - { + + for(i = 0; i < count; i++) { mat_trans_texture2_nomod(uv[0], uv[1], dst[i].u, dst[i].v); - + uv += GL_KOS_TEXCOORD0_STRIDE; } - - _glKosMatrixLoadRender(); + + _glKosMatrixLoadRender(); } - else - { + else { for(i = 0; i < count; i++) { dst[i].u = uv[0]; dst[i].v = uv[1]; diff --git a/gl-cap.c b/gl-cap.c index 10e2617..af4ac60 100755 --- a/gl-cap.c +++ b/gl-cap.c @@ -67,7 +67,7 @@ void APIENTRY glEnable(GLenum cap) { case GL_CULL_FACE: GL_KOS_ENABLE_CAP |= GL_KOS_ENABLE_CULLING; break; - + case GL_KOS_TEXTURE_MATRIX: GL_KOS_ENABLE_CAP |= GL_KOS_ENABLE_TEXTURE_MAT; break; @@ -110,7 +110,7 @@ void APIENTRY glDisable(GLenum cap) { case GL_CULL_FACE: GL_KOS_ENABLE_CAP &= ~GL_KOS_ENABLE_CULLING; break; - + case GL_KOS_TEXTURE_MATRIX: GL_KOS_ENABLE_CAP &= ~GL_KOS_ENABLE_TEXTURE_MAT; break; @@ -144,7 +144,7 @@ GLboolean APIENTRY glIsEnabled(GLenum cap) { case GL_BLEND: return _glKosEnabledBlend() ? GL_TRUE : GL_FALSE; - + case GL_KOS_TEXTURE_MATRIX: return _glKosEnabledTextureMatrix() ? GL_TRUE : GL_FALSE; } @@ -228,23 +228,21 @@ void APIENTRY glGetFloatv(GLenum pname, GLfloat *params) { } } -const GLbyte* glGetString(GLenum name) -{ - switch(name) - { +const GLbyte *glGetString(GLenum name) { + switch(name) { case GL_VENDOR: - return "KallistiOS"; - + return "KallistiOS"; + case GL_RENDERER: - return "PowerVR2 CLX2 100mHz"; - + return "PowerVR2 CLX2 100mHz"; + case GL_VERSION: - return "KGL 1.x"; - + return "KGL 1.x"; + case GL_EXTENSIONS: - return "GL_ARB_framebuffer_object, GL_ARB_multitexture"; + return "GL_ARB_framebuffer_object, GL_ARB_multitexture"; } - + return "GL_KOS_ERROR: ENUM Unsupported\n"; } diff --git a/gl-fog.c b/gl-fog.c index 82dcd4b..71eb36b 100755 --- a/gl-fog.c +++ b/gl-fog.c @@ -11,92 +11,85 @@ #include "gl.h" -static GLuint FOG_MODE = GL_EXP; /* GL_LINEAR, GL_EXP, or GL_EXP2 FOG */ -static GLfloat FOG_DENSITY = 1.0f, /* Density - GL_EXP, or GL_EXP2 FOG */ - FOG_START = 0.0f, /* Linear FOG */ - FOG_END = 1.0f; /* Linear FOG */ +static GLuint GL_KOS_FOG_MODE = GL_EXP; /* GL_LINEAR, GL_EXP, or GL_EXP2 FOG */ +static GLfloat GL_KOS_FOG_DENSITY = 1.0f, /* Density - GL_EXP, or GL_EXP2 FOG */ + GL_KOS_FOG_START = 0.0f, /* Linear FOG */ + GL_KOS_FOG_END = 1.0f; /* Linear FOG */ void APIENTRY glFogi(GLenum pname, GLint param) { switch(pname) { case GL_FOG_MODE: switch(param) { case GL_LINEAR: - return pvr_fog_table_linear(FOG_START, FOG_END); + pvr_fog_table_linear(GL_KOS_FOG_START, GL_KOS_FOG_END); + break; case GL_EXP: - return pvr_fog_table_exp(FOG_DENSITY); + pvr_fog_table_exp(GL_KOS_FOG_DENSITY); + break; case GL_EXP2: - return pvr_fog_table_exp2(FOG_DENSITY); - - default: - return; + pvr_fog_table_exp2(GL_KOS_FOG_DENSITY); + break; } - - default: - return; } } void APIENTRY glFogf(GLenum pname, GLfloat param) { switch(pname) { case GL_FOG_START: - FOG_START = param; + GL_KOS_FOG_START = param; - if(FOG_MODE == GL_LINEAR) - return pvr_fog_table_linear(FOG_START, FOG_END); + if(GL_KOS_FOG_MODE == GL_LINEAR) + pvr_fog_table_linear(GL_KOS_FOG_START, GL_KOS_FOG_END); - return; + break; case GL_FOG_END: - FOG_END = param; + GL_KOS_FOG_END = param; - if(FOG_MODE == GL_LINEAR) - return pvr_fog_table_linear(FOG_START, FOG_END); + if(GL_KOS_FOG_MODE == GL_LINEAR) + pvr_fog_table_linear(GL_KOS_FOG_START, GL_KOS_FOG_END); - return; + break; case GL_FOG_DENSITY: - FOG_DENSITY = param; + GL_KOS_FOG_DENSITY = param; - if(FOG_MODE == GL_EXP) - return pvr_fog_table_exp(FOG_DENSITY); + if(GL_KOS_FOG_MODE == GL_EXP) + pvr_fog_table_exp(GL_KOS_FOG_DENSITY); - if(FOG_MODE == GL_EXP2) - return pvr_fog_table_exp2(FOG_DENSITY); + else if(GL_KOS_FOG_MODE == GL_EXP2) + pvr_fog_table_exp2(GL_KOS_FOG_DENSITY); - return; - - default: - return; + break; } } void APIENTRY glFogfv(GLenum pname, const GLfloat *params) { switch(pname) { case GL_FOG_MODE: - return glFogi(pname, (GLint) * params); + glFogi(pname, (GLint) * params); + break; case GL_FOG_DENSITY: - FOG_DENSITY = *params; + GL_KOS_FOG_DENSITY = *params; - if(FOG_MODE == GL_EXP) - return pvr_fog_table_exp(FOG_DENSITY); + if(GL_KOS_FOG_MODE == GL_EXP) + pvr_fog_table_exp(GL_KOS_FOG_DENSITY); - if(FOG_MODE == GL_EXP2) - return pvr_fog_table_exp2(FOG_DENSITY); + else if(GL_KOS_FOG_MODE == GL_EXP2) + pvr_fog_table_exp2(GL_KOS_FOG_DENSITY); - return; + break; case GL_FOG_START: case GL_FOG_END: - return glFogf(pname, *params); + glFogf(pname, *params); + break; case GL_FOG_COLOR: - return pvr_fog_table_color(params[3], params[0], params[1], params[2]); - - case GL_FOG_INDEX: - default: - return; + pvr_fog_table_color(params[3], params[0], params[1], params[2]); + break; } } diff --git a/gl-light.c b/gl-light.c index 78f7fbc..b37ba98 100755 --- a/gl-light.c +++ b/gl-light.c @@ -76,7 +76,7 @@ void _glKosEnableLight(const GLuint light) { GL_LIGHT_ENABLED |= (1 << (light & 0xF)); } -/* Disable a light - GL_LIGHT0->GL_LIGHT7 */ +/* Disable a light - GL_LIGHT0->GL_LIGHT0 + GL_KOS_MAX_LIGHTS */ void _glKosDisableLight(const GLuint light) { if(light < GL_LIGHT0 || light > GL_LIGHT0 + GL_KOS_MAX_LIGHTS) { _glKosThrowError(GL_INVALID_ENUM, "glDisable(GL_LIGHT)"); @@ -152,7 +152,7 @@ static inline void glCopy3f(const float *src, float *dst) { /* GL Light Parameters ******************************************************/ void glLightfv(GLenum light, GLenum pname, const GLfloat *params) { - if(light < GL_LIGHT0 || light > GL_LIGHT7) return; + if(light < GL_LIGHT0 || light > GL_LIGHT0 + GL_KOS_MAX_LIGHTS) return; switch(pname) { case GL_AMBIENT: @@ -217,7 +217,7 @@ void glLightfv(GLenum light, GLenum pname, const GLfloat *params) { } void glLightf(GLenum light, GLenum pname, GLfloat param) { - if(light < GL_LIGHT0 || light > GL_LIGHT7) return; + if(light < GL_LIGHT0 || light > GL_LIGHT0 + GL_KOS_MAX_LIGHTS) return; switch(pname) { case GL_CONSTANT_ATTENUATION: diff --git a/gl-matrix.c b/gl-matrix.c index 1e9484a..b840d2d 100755 --- a/gl-matrix.c +++ b/gl-matrix.c @@ -123,11 +123,11 @@ void glScalef(GLfloat x, GLfloat y, GLfloat z) { mat_store(Matrix + MatrixMode); } -void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) { +void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) { float r = DEG2RAD * -angle; - - vec3f_normalize(x, y, z); - + + vec3f_normalize(x, y, z); + mat_load(Matrix + MatrixMode); mat_rotate(r * x, r * y, r * z); mat_store(Matrix + MatrixMode); diff --git a/gl-pvr.c b/gl-pvr.c index 0ecfbe2..106f531 100755 --- a/gl-pvr.c +++ b/gl-pvr.c @@ -87,7 +87,7 @@ static inline void pvr_hdr_submit(const GLuint *src) { d[5] = *(src++); d[6] = *(src++); d[7] = *(src++); - + asm("pref @%0" : : "r"(d)); } @@ -208,17 +208,17 @@ static inline void glutSwapBuffer() { PVR_DMA_TA, 1, NULL, 0); #else pvr_list_submit(_glKosVertexBufAddress(GL_KOS_LIST_OP), _glKosVertexBufCount(GL_KOS_LIST_OP)); -#endif +#endif pvr_list_finish(); pvr_list_begin(PVR_LIST_TR_POLY); #ifdef GL_KOS_USE_DMA pvr_dma_transfer(_glKosVertexBufAddress(GL_KOS_LIST_TR), 0, _glKosVertexBufCount(GL_KOS_LIST_TR) * 32, - PVR_DMA_TA, 1, NULL, 0); + PVR_DMA_TA, 1, NULL, 0); #else pvr_list_submit(_glKosVertexBufAddress(GL_KOS_LIST_TR), _glKosVertexBufCount(GL_KOS_LIST_TR)); -#endif +#endif /* Multi-Texture Pass - Modify U/V coords of submitted vertices */ GLuint i, v; glTexCoord *mt = _glKosMultiUVBufAddress(); @@ -236,7 +236,7 @@ static inline void glutSwapBuffer() { pvr_hdr_submit((GLuint *)&GL_MTOBJS[i].hdr); pvr_dma_transfer(GL_MTOBJS[i].src, 0, GL_MTOBJS[i].count * 32, PVR_DMA_TA, 1, NULL, 0); -#else +#else pvr_list_submit((pvr_poly_hdr_t *)&GL_MTOBJS[i].hdr, 1); pvr_list_submit((pvr_vertex_t *)GL_MTOBJS[i].src, GL_MTOBJS[i].count); #endif diff --git a/gl-rgb.c b/gl-rgb.c index 7c8f391..500555a 100755 --- a/gl-rgb.c +++ b/gl-rgb.c @@ -119,51 +119,45 @@ uint16 __glKosAverageBiPixelARGB4444(uint16 p1, uint16 p2) { //===================================================================================================// //== Colorspace Conversion ==// -static uint16 _glConvPixelRGBAU32(uint8 r, uint8 g, uint8 b, uint8 a) -{ +static uint16 _glConvPixelRGBAU32(uint8 r, uint8 g, uint8 b, uint8 a) { return (uint16)((a & RGB4_MAX) << ARGB4444_ALPHA_SHIFT) | - ((r & RGB4_MAX) << ARGB4444_RED_SHIFT) | - ((g & RGB4_MAX) << ARGB4444_GREEN_SHIFT) | - ((b & RGB4_MAX)); + ((r & RGB4_MAX) << ARGB4444_RED_SHIFT) | + ((g & RGB4_MAX) << ARGB4444_GREEN_SHIFT) | + ((b & RGB4_MAX)); } -static uint16 _glConvPixelRGBU24(uint8 r, uint8 g, uint8 b) -{ - return (uint16)((r & RGB5_MAX) << RGB565_RED_SHIFT) | - ((g & RGB6_MAX) << RGB565_GREEN_SHIFT) | - ((b & RGB5_MAX)); +static uint16 _glConvPixelRGBU24(uint8 r, uint8 g, uint8 b) { + return (uint16)((r & RGB5_MAX) << RGB565_RED_SHIFT) | + ((g & RGB6_MAX) << RGB565_GREEN_SHIFT) | + ((b & RGB5_MAX)); } -static void _glConvPixelsRGBF(int w, int h, float * src, uint16 * dst) -{ +static void _glConvPixelsRGBF(int w, int h, float *src, uint16 *dst) { int i; - for(i = 0; i < w * h; i++) - { + + for(i = 0; i < w * h; i++) { dst[i] = _glConvPixelRGBU24((uint8)(src[i * 3 + 0] * RGB5_MAX), (uint8)(src[i * 3 + 1] * RGB6_MAX), (uint8)(src[i * 3 + 2] * RGB5_MAX)); - } + } } ...<truncated>... hooks/post-receive -- The KallistiOS port of OpenGL. |
From: Lawrence S. <ljs...@us...> - 2015-09-09 14:39:54
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The KallistiOS port of OpenGL.". The branch, master has been updated via 46ed1d5353edae37064e3154d4ad8e5ee4bae2bc (commit) from 5fce3e1897b6069708bd9f3a9f3d995ccbc1992f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 46ed1d5353edae37064e3154d4ad8e5ee4bae2bc Author: Lawrence Sebald <ljs...@us...> Date: Wed Sep 9 10:39:22 2015 -0400 Don't allocate texture conversion space on the stack, as it is likely to overflow the stack and corrupt heap memory. ----------------------------------------------------------------------- Summary of changes: gl-texture.c | 33 +++++++++++++++------------------ 1 files changed, 15 insertions(+), 18 deletions(-) diff --git a/gl-texture.c b/gl-texture.c index 325843d..fa5a3ef 100755 --- a/gl-texture.c +++ b/gl-texture.c @@ -264,48 +264,45 @@ void APIENTRY glTexImage2D(GLenum target, GLint level, GLint internalFormat, case GL_UNSIGNED_SHORT: case GL_FLOAT: { - uint16 tex[width * height]; - + uint16 *tex; + + tex = (uint16 *)malloc(width * height * sizeof(uint16)); + if(!tex) { + _glKosThrowError(GL_OUT_OF_MEMORY, "glTexImage2D"); + _glKosPrintError(); + return; + } + switch(internalFormat) { case GL_RGB: - _glPixelConvertRGB(type, width, height, (void *)data, tex); - GL_KOS_TEXTURE_UNIT[GL_KOS_ACTIVE_TEXTURE]->color = (PVR_TXRFMT_RGB565 | PVR_TXRFMT_NONTWIDDLED); - sq_cpy(GL_KOS_TEXTURE_UNIT[GL_KOS_ACTIVE_TEXTURE]->data, tex, bytes); - break; case GL_RGBA: - _glPixelConvertRGBA(type, width, height, (void *)data, tex); - GL_KOS_TEXTURE_UNIT[GL_KOS_ACTIVE_TEXTURE]->color = (PVR_TXRFMT_ARGB4444 | PVR_TXRFMT_NONTWIDDLED); - sq_cpy(GL_KOS_TEXTURE_UNIT[GL_KOS_ACTIVE_TEXTURE]->data, tex, bytes); - break; } + + free(tex); } break; - + case GL_UNSIGNED_SHORT_5_6_5: /* Texture Formats that do not need conversion */ - case GL_UNSIGNED_SHORT_5_6_5_TWID: - case GL_UNSIGNED_SHORT_1_5_5_5: + case GL_UNSIGNED_SHORT_5_6_5_TWID: + case GL_UNSIGNED_SHORT_1_5_5_5: case GL_UNSIGNED_SHORT_1_5_5_5_TWID: case GL_UNSIGNED_SHORT_4_4_4_4: case GL_UNSIGNED_SHORT_4_4_4_4_TWID: - sq_cpy(GL_KOS_TEXTURE_UNIT[GL_KOS_ACTIVE_TEXTURE]->data, data, bytes); - break; - + default: /* Unsupported Texture Format */ - _glKosThrowError(GL_INVALID_OPERATION, "glTexImage2D"); - break; } } hooks/post-receive -- The KallistiOS port of OpenGL. |
From: Christian G. <sa...@us...> - 2015-09-08 21:51:26
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 47c0d9da02a26c74310b0d7d13dd5ee367d736cb (commit) from 0e0e21d4f7e9c860cd31a620233e8524defde91b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 47c0d9da02a26c74310b0d7d13dd5ee367d736cb Author: Christian Groessler <ch...@gr...> Date: Tue Sep 8 23:43:13 2015 +0200 Add rudimentary support in the linker script to use OCRAM. Only uninitialized variables are supported and they are *really* uninitialized. This means they aren't set to zero like .bss. Example usage: char ocdata[256] __attribute__((section (".ocram"))); ----------------------------------------------------------------------- Summary of changes: doc/CHANGELOG | 1 + utils/ldscripts/shlelf.xc | 7 +++++++ 2 files changed, 8 insertions(+), 0 deletions(-) diff --git a/doc/CHANGELOG b/doc/CHANGELOG index fb6a185..1427084 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -71,6 +71,7 @@ KallistiOS version 2.1.0 ----------------------------------------------- - DC Added light gun support roughly based on how it is done in libronin [LS] - DC Added a very simple light gun example [LS] - DC Added support for Spanish keyboards [Xavier Vallejo == XV] +- DC Added rudimentary support for OCRAM in linker script [CG] KallistiOS version 2.0.0 ----------------------------------------------- - DC Broadband Adapter driver fixes [Dan Potter == DP] diff --git a/utils/ldscripts/shlelf.xc b/utils/ldscripts/shlelf.xc index 06714ae..60418ea 100644 --- a/utils/ldscripts/shlelf.xc +++ b/utils/ldscripts/shlelf.xc @@ -186,6 +186,13 @@ SECTIONS . = ALIGN(32 / 8); . = ALIGN(32 / 8); _end = .; PROVIDE (end = .); + .ocram 0x7c001000 (NOLOAD) : + { + *(.ocram) + /* We have 8kb of operand cache RAM. The next line lets ld throw + an error if we exceed that size. */ + . = . > 0x2000 ? 0x2000 : .; + } /* Stabs debugging sections. */ .stab 0 : { *(.stab) } .stabstr 0 : { *(.stabstr) } hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: PH3NOM <ph...@us...> - 2015-09-06 16:50:13
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The KallistiOS port of OpenGL.". The branch, master has been updated via 5fce3e1897b6069708bd9f3a9f3d995ccbc1992f (commit) from 25ba67b9b1a02ee95633fbbc70c494917283a71b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 5fce3e1897b6069708bd9f3a9f3d995ccbc1992f Author: Josh Pearson <ph...@us...> Date: Sun Sep 6 09:47:57 2015 -0700 Added Texture Format Conversion to glTexImage2D, Added GL_TEXTURE Matrix Transformations when glEnable(GL_KOS_TEXTURE_MATRIX), various bug fixes, few more API functions added ----------------------------------------------------------------------- Summary of changes: Makefile | 2 +- gl-api.c | 61 +++++++++++++++-- gl-api.h | 6 ++ gl-arrays.c | 80 +++++++++++++++++---- gl-cap.c | 38 ++++++++++- gl-matrix.c | 11 +++- gl-pvr.c | 38 +++++++++- gl-pvr.h | 2 +- gl-rgb.c | 220 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- gl-rgb.h | 9 ++- gl-sh4.h | 34 +++++++++ gl-texture.c | 70 +++++++++++++++---- include/gl.h | 47 +++++++++++- 13 files changed, 568 insertions(+), 50 deletions(-) diff --git a/Makefile b/Makefile index 53b3f5d..e3ceec2 100755 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ # Copyright (C) 2013, 2014 Josh Pearson # Copyright (C) 2014 Lawrence Sebald -TARGET = libgl.a +TARGET = libGL.a OBJS = gl-rgb.o gl-fog.o gl-sh4-light.o gl-light.o gl-clip.o gl-clip-arrays.o OBJS += gl-arrays.o gl-pvr.o gl-matrix.o gl-api.o gl-texture.o glu-texture.o OBJS += gl-framebuffer.o gl-cap.o gl-error.o diff --git a/gl-api.c b/gl-api.c index b9fae8c..dedfa6b 100755 --- a/gl-api.c +++ b/gl-api.c @@ -36,6 +36,7 @@ static GLuint GL_KOS_VERTEX_COUNT = 0; static GLuint GL_KOS_VERTEX_MODE = GL_TRIANGLES; static GLuint GL_KOS_VERTEX_COLOR = 0xFFFFFFFF; static GLfloat GL_KOS_VERTEX_UV[2] = { 0, 0 }; +//static glTexCoord4f GL_KOS_VERTEX_TEX_COORD = { 0, 0, 0, 1 }; static GLfloat GL_KOS_COLOR_CLEAR[3] = { 0, 0, 0 }; @@ -266,13 +267,33 @@ void APIENTRY glColor4fv(const GLfloat *rgba) { //== Texture Coordinate Submission ==// void APIENTRY glTexCoord2f(GLfloat u, GLfloat v) { - GL_KOS_VERTEX_UV[0] = u; - GL_KOS_VERTEX_UV[1] = v; + if(_glKosEnabledTextureMatrix()) + { + _glKosMatrixLoadTexture(); + + mat_trans_texture2_nomod(u, v, GL_KOS_VERTEX_UV[0], GL_KOS_VERTEX_UV[1]); + + _glKosMatrixLoadRender(); + } + else { + GL_KOS_VERTEX_UV[0] = u; + GL_KOS_VERTEX_UV[1] = v; + } } void APIENTRY glTexCoord2fv(const GLfloat *uv) { - GL_KOS_VERTEX_UV[0] = uv[0]; - GL_KOS_VERTEX_UV[1] = uv[1]; + if(_glKosEnabledTextureMatrix()) + { + _glKosMatrixLoadTexture(); + + mat_trans_texture2_nomod(uv[0], uv[1], GL_KOS_VERTEX_UV[0], GL_KOS_VERTEX_UV[1]); + + _glKosMatrixLoadRender(); + } + else { + GL_KOS_VERTEX_UV[0] = uv[0]; + GL_KOS_VERTEX_UV[1] = uv[1]; + } } //== Vertex Position Submission Functions ==// @@ -923,4 +944,34 @@ GLubyte _glKosDepthMask() { GLuint _glKosVertexColor() { return GL_KOS_VERTEX_COLOR; -} \ No newline at end of file +} + +void glAlphaFunc(GLenum func, GLclampf ref) +{ + ; +} + +void glLineWidth(GLfloat width) +{ + ; +} + +void glPolygonOffset(GLfloat factor, GLfloat units) +{ + ; +} + +void glGetTexParameteriv(GLenum target, GLenum pname, GLint * params) +{ + ; +} + +void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) +{ + ; +} + +void glPixelStorei(GLenum pname, GLint param) +{ + ; +} diff --git a/gl-api.h b/gl-api.h index 9f3082f..fa3c15f 100755 --- a/gl-api.h +++ b/gl-api.h @@ -22,6 +22,10 @@ typedef struct { } glTexCoord; /* Simple Texture Coordinate used for Multi-Texturing */ typedef struct { + GLfloat s, t, r, q; +} glTexCoord4f; /* 3D Texture Coordinate */ + +typedef struct { GLushort width; GLushort height; GLuint color; @@ -144,6 +148,7 @@ void _glKosMatrixLoadModelRot(); void _glKosMatrixApplyScreenSpace(); void _glKosMatrixApplyRender(); void _glKosMatrixLoadRender(); +void _glKosMatrixLoadTexture(); /* API Enabled Capabilities Internal Functions */ GLubyte _glKosEnabledBlend(); @@ -202,6 +207,7 @@ GLubyte _glKosGetMaxLights(); GLuint _glKosBoundTexID(); GLuint _glKosVertexColor(); GLubyte _glKosMaxTextureUnits(); +GLubyte _glKosEnabledTextureMatrix(); GL_TEXTURE_OBJECT *_glKosBoundMultiTexID(); diff --git a/gl-arrays.c b/gl-arrays.c index efdc366..3deee29 100755 --- a/gl-arrays.c +++ b/gl-arrays.c @@ -1,7 +1,7 @@ /* KallistiGL for KallistiOS ##version## libgl/gl-arrays.c - Copyright (C) 2013-2014 Josh Pearson + Copyright (C) 2013-2015 Josh Pearson Arrays Input Primitive Types Supported: -GL_TRIANGLES @@ -455,14 +455,31 @@ static inline void _glKosElementColor4fU16(pvr_vertex_t *dst, GLuint count) { //== Texture Coordinates ==// + + static inline void _glKosElementTexCoord2fU16(pvr_vertex_t *dst, GLuint count) { GLuint i, index; GLfloat *t = GL_KOS_TEXCOORD0_POINTER; - for(i = 0; i < count; i++) { - index = GL_KOS_INDEX_POINTER_U16[i] * GL_KOS_TEXCOORD0_STRIDE; - dst[i].u = t[index]; - dst[i].v = t[index + 1]; + if(_glKosEnabledTextureMatrix()) + { + _glKosMatrixLoadTexture(); + + for(i = 0; i < count; i++) + { + index = GL_KOS_INDEX_POINTER_U16[i] * GL_KOS_TEXCOORD0_STRIDE; + + mat_trans_texture2_nomod(t[index], t[index + 1], dst[i].u, dst[i].v); + } + + _glKosMatrixLoadRender(); + } + else { + for(i = 0; i < count; i++) { + index = GL_KOS_INDEX_POINTER_U16[i] * GL_KOS_TEXCOORD0_STRIDE; + dst[i].u = t[index]; + dst[i].v = t[index + 1]; + } } } @@ -470,10 +487,25 @@ static inline void _glKosElementTexCoord2fU8(pvr_vertex_t *dst, GLuint count) { GLuint i, index; GLfloat *t = GL_KOS_TEXCOORD0_POINTER; - for(i = 0; i < count; i++) { - index = GL_KOS_INDEX_POINTER_U8[i] * GL_KOS_TEXCOORD0_STRIDE; - dst[i].u = t[index]; - dst[i].v = t[index + 1]; + if(_glKosEnabledTextureMatrix()) + { + _glKosMatrixLoadTexture(); + + for(i = 0; i < count; i++) + { + index = GL_KOS_INDEX_POINTER_U8[i] * GL_KOS_TEXCOORD0_STRIDE; + + mat_trans_texture2_nomod(t[index], t[index + 1], dst[i].u, dst[i].v); + } + + _glKosMatrixLoadRender(); + } + else { + for(i = 0; i < count; i++) { + index = GL_KOS_INDEX_POINTER_U8[i] * GL_KOS_TEXCOORD0_STRIDE; + dst[i].u = t[index]; + dst[i].v = t[index + 1]; + } } } @@ -610,7 +642,7 @@ static inline void _glKosArrayFlagsSetQuad(pvr_vertex_t *dst, GLuint count) { GLuint i; for(i = 0; i < count; i += 4) { - _glKosVertexSwizzle(&dst[2], &dst[3]); + _glKosVertexSwizzle(&dst[i + 2], &dst[i + 3]); dst[i + 0].flags = dst[i + 1].flags = dst[i + 2].flags = PVR_CMD_VERTEX; dst[i + 3].flags = PVR_CMD_VERTEX_EOL; } @@ -1018,11 +1050,27 @@ static inline void _glKosArrayColor4f(pvr_vertex_t *dst, GLuint count) { static inline void _glKosArrayTexCoord2f(pvr_vertex_t *dst, GLuint count) { GLuint i; GLfloat *uv = GL_KOS_TEXCOORD0_POINTER; - - for(i = 0; i < count; i++) { - dst[i].u = uv[0]; - dst[i].v = uv[1]; - uv += GL_KOS_TEXCOORD0_STRIDE; + + if(_glKosEnabledTextureMatrix()) + { + _glKosMatrixLoadTexture(); + + for(i = 0; i < count; i++) + { + mat_trans_texture2_nomod(uv[0], uv[1], dst[i].u, dst[i].v); + + uv += GL_KOS_TEXCOORD0_STRIDE; + } + + _glKosMatrixLoadRender(); + } + else + { + for(i = 0; i < count; i++) { + dst[i].u = uv[0]; + dst[i].v = uv[1]; + uv += GL_KOS_TEXCOORD0_STRIDE; + } } } @@ -1191,4 +1239,4 @@ void APIENTRY glClientActiveTextureARB(GLenum texture) { } GL_KOS_CLIENT_ACTIVE_TEXTURE = texture & 0xF; -} \ No newline at end of file +} diff --git a/gl-cap.c b/gl-cap.c index 3857518..10e2617 100755 --- a/gl-cap.c +++ b/gl-cap.c @@ -24,6 +24,7 @@ #define GL_KOS_ENABLE_SUPERSAMPLE (1<<6) #define GL_KOS_ENABLE_TEXTURE2D (1<<7) #define GL_KOS_ENABLE_BLENDING (1<<8) +#define GL_KOS_ENABLE_TEXTURE_MAT (1<<9) static GLbitfield GL_KOS_ENABLE_CAP = 0; @@ -66,6 +67,10 @@ void APIENTRY glEnable(GLenum cap) { case GL_CULL_FACE: GL_KOS_ENABLE_CAP |= GL_KOS_ENABLE_CULLING; break; + + case GL_KOS_TEXTURE_MATRIX: + GL_KOS_ENABLE_CAP |= GL_KOS_ENABLE_TEXTURE_MAT; + break; } } @@ -105,6 +110,10 @@ void APIENTRY glDisable(GLenum cap) { case GL_CULL_FACE: GL_KOS_ENABLE_CAP &= ~GL_KOS_ENABLE_CULLING; break; + + case GL_KOS_TEXTURE_MATRIX: + GL_KOS_ENABLE_CAP &= ~GL_KOS_ENABLE_TEXTURE_MAT; + break; } } @@ -135,6 +144,9 @@ GLboolean APIENTRY glIsEnabled(GLenum cap) { case GL_BLEND: return _glKosEnabledBlend() ? GL_TRUE : GL_FALSE; + + case GL_KOS_TEXTURE_MATRIX: + return _glKosEnabledTextureMatrix() ? GL_TRUE : GL_FALSE; } return GL_FALSE; @@ -216,6 +228,26 @@ void APIENTRY glGetFloatv(GLenum pname, GLfloat *params) { } } +const GLbyte* glGetString(GLenum name) +{ + switch(name) + { + case GL_VENDOR: + return "KallistiOS"; + + case GL_RENDERER: + return "PowerVR2 CLX2 100mHz"; + + case GL_VERSION: + return "KGL 1.x"; + + case GL_EXTENSIONS: + return "GL_ARB_framebuffer_object, GL_ARB_multitexture"; + } + + return "GL_KOS_ERROR: ENUM Unsupported\n"; +} + //===============================================================================// //== Internal API Functions ==// @@ -249,4 +281,8 @@ GLubyte _glKosEnabledTexture2D() { GLubyte _glKosEnabledBlend() { return (GL_KOS_ENABLE_CAP & GL_KOS_ENABLE_BLENDING) >> 8; -} \ No newline at end of file +} + +GLubyte _glKosEnabledTextureMatrix() { + return (GL_KOS_ENABLE_CAP & GL_KOS_ENABLE_TEXTURE_MAT) >> 9; +} diff --git a/gl-matrix.c b/gl-matrix.c index 6863771..1e9484a 100755 --- a/gl-matrix.c +++ b/gl-matrix.c @@ -123,8 +123,11 @@ void glScalef(GLfloat x, GLfloat y, GLfloat z) { mat_store(Matrix + MatrixMode); } -void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) { - float r = DEG2RAD * angle; +void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) { + float r = DEG2RAD * -angle; + + vec3f_normalize(x, y, z); + mat_load(Matrix + MatrixMode); mat_rotate(r * x, r * y, r * z); mat_store(Matrix + MatrixMode); @@ -366,6 +369,10 @@ void _glKosMatrixLoadRender() { mat_load(Matrix + GL_RENDER); } +void _glKosMatrixLoadTexture() { + mat_load(Matrix + GL_TEXTURE); +} + void _glKosMatrixLoadModelView() { mat_load(Matrix + GL_MODELVIEW); } diff --git a/gl-pvr.c b/gl-pvr.c index 5d7e4a1..0ecfbe2 100755 --- a/gl-pvr.c +++ b/gl-pvr.c @@ -75,6 +75,22 @@ static inline void pvr_list_submit(void *src, int n) { d[0] = d[8] = 0; } +/* Custom version of sq_cpy from KOS for copying 32bytes of vertex data to the PVR */ +static inline void pvr_hdr_submit(const GLuint *src) { + GLuint *d = TA_SQ_ADDR; + + d[0] = *(src++); + d[1] = *(src++); + d[2] = *(src++); + d[3] = *(src++); + d[4] = *(src++); + d[5] = *(src++); + d[6] = *(src++); + d[7] = *(src++); + + asm("pref @%0" : : "r"(d)); +} + inline void _glKosPushMultiTexObject(GL_TEXTURE_OBJECT *tex, pvr_vertex_t *src, GLuint count) { @@ -186,15 +202,23 @@ inline void _glKosVertexBufCopy(void *dst, void *src, GLuint count) { static inline void glutSwapBuffer() { pvr_list_begin(PVR_LIST_OP_POLY); - +#ifdef GL_KOS_USE_DMA + pvr_dma_transfer(_glKosVertexBufAddress(GL_KOS_LIST_OP), 0, + _glKosVertexBufCount(GL_KOS_LIST_OP) * 32, + PVR_DMA_TA, 1, NULL, 0); +#else pvr_list_submit(_glKosVertexBufAddress(GL_KOS_LIST_OP), _glKosVertexBufCount(GL_KOS_LIST_OP)); - +#endif pvr_list_finish(); pvr_list_begin(PVR_LIST_TR_POLY); - +#ifdef GL_KOS_USE_DMA + pvr_dma_transfer(_glKosVertexBufAddress(GL_KOS_LIST_TR), 0, + _glKosVertexBufCount(GL_KOS_LIST_TR) * 32, + PVR_DMA_TA, 1, NULL, 0); +#else pvr_list_submit(_glKosVertexBufAddress(GL_KOS_LIST_TR), _glKosVertexBufCount(GL_KOS_LIST_TR)); - +#endif /* Multi-Texture Pass - Modify U/V coords of submitted vertices */ GLuint i, v; glTexCoord *mt = _glKosMultiUVBufAddress(); @@ -208,8 +232,14 @@ static inline void glutSwapBuffer() { } // submit vertex data to PVR +#ifdef GL_KOS_USE_DMA + pvr_hdr_submit((GLuint *)&GL_MTOBJS[i].hdr); + pvr_dma_transfer(GL_MTOBJS[i].src, 0, + GL_MTOBJS[i].count * 32, PVR_DMA_TA, 1, NULL, 0); +#else pvr_list_submit((pvr_poly_hdr_t *)&GL_MTOBJS[i].hdr, 1); pvr_list_submit((pvr_vertex_t *)GL_MTOBJS[i].src, GL_MTOBJS[i].count); +#endif } _glKosResetMultiTexObject(); /* End Multi-Texture Pass */ diff --git a/gl-pvr.h b/gl-pvr.h index 03128cd..5348d04 100755 --- a/gl-pvr.h +++ b/gl-pvr.h @@ -30,8 +30,8 @@ typedef struct { #define GL_KOS_LIST_TR 1 #define GL_KOS_USE_MALLOC 1 /* Use Dynamic Vertex Array */ +//#define GL_KOS_USE_DMA 1 /* Use PVR DMA for vertex data transfer instead of store queues */ //#define GL_USE_FLOAT 0 /* Use PVR's floating-point color Vertex Type (64bit) *NoOp* */ -//#define GL_USE_DMA 0 /* Use PVR DMA for vertex data transfer *NoOp* */ /* Misc SH4->PVR Commands */ #define TA_SQ_ADDR (unsigned int *)(void *) \ diff --git a/gl-rgb.c b/gl-rgb.c index 7138b6d..7c8f391 100755 --- a/gl-rgb.c +++ b/gl-rgb.c @@ -1,9 +1,10 @@ /* KallistiGL for KallistiOS ##version## libgl/gl-rgb.c - Copyright (C) 2013-2014 Josh Pearson + Copyright (C) 2013-2015 Josh Pearson A set of functions for working with ARGB pixel data, used by gluBuild2DMipmaps(...). + The pixel conversion functions are for submitting textures not supported by the PVR. */ #include "gl.h" @@ -114,3 +115,220 @@ uint16 __glKosAverageBiPixelARGB4444(uint16 p1, uint16 p2) { return ((A & RGB4_MAX) << ARGB4444_ALPHA_SHIFT) | ((R & RGB4_MAX) << ARGB4444_RED_SHIFT) | ((G & RGB4_MAX) << ARGB4444_GREEN_SHIFT) | (B & RGB4_MAX); } + +//===================================================================================================// +//== Colorspace Conversion ==// + +static uint16 _glConvPixelRGBAU32(uint8 r, uint8 g, uint8 b, uint8 a) +{ + return (uint16)((a & RGB4_MAX) << ARGB4444_ALPHA_SHIFT) | + ((r & RGB4_MAX) << ARGB4444_RED_SHIFT) | + ((g & RGB4_MAX) << ARGB4444_GREEN_SHIFT) | + ((b & RGB4_MAX)); +} + +static uint16 _glConvPixelRGBU24(uint8 r, uint8 g, uint8 b) +{ + return (uint16)((r & RGB5_MAX) << RGB565_RED_SHIFT) | + ((g & RGB6_MAX) << RGB565_GREEN_SHIFT) | + ((b & RGB5_MAX)); +} + +static void _glConvPixelsRGBF(int w, int h, float * src, uint16 * dst) +{ + int i; + for(i = 0; i < w * h; i++) ...<truncated>... hooks/post-receive -- The KallistiOS port of OpenGL. |
From: Lawrence S. <ljs...@us...> - 2015-09-05 02:55:52
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 0e0e21d4f7e9c860cd31a620233e8524defde91b (commit) from 2d702cd695697ad0e51bdd4c3eaab591e1c98b98 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 0e0e21d4f7e9c860cd31a620233e8524defde91b Author: Lawrence Sebald <ljs...@us...> Date: Fri Sep 4 22:55:31 2015 -0400 Add explanation of the flip/clamping modes on the PVR U/V coordinates. ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/include/dc/pvr.h | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-) diff --git a/kernel/arch/dreamcast/include/dc/pvr.h b/kernel/arch/dreamcast/include/dc/pvr.h index 3bc6ce4..c29ffeb 100644 --- a/kernel/arch/dreamcast/include/dc/pvr.h +++ b/kernel/arch/dreamcast/include/dc/pvr.h @@ -419,6 +419,18 @@ typedef struct { /** @} */ /** \defgroup pvr_uv_flip Enable or disable U/V flipping on the PVR + + These flags determine what happens when U/V coordinate values exceed 1.0. + In any of the flipped cases, the specified coordinate value will flip around + after 1.0, essentially mirroring the image. So, if you displayed an image + with a U coordinate of 0.0 on the left hand side and 2.0 on the right hand + side with U flipping turned on, you'd have an image that was displayed twice + as if mirrored across the middle. This mirroring behavior happens at every + unit boundary (so at 2.0 it returns to normal, at 3.0 it flips, etc). + + The default case is to disable mirroring. In addition, clamping of the U/V + coordinates by PVR_UVCLAMP_U, PVR_UVCLAMP_V, or PVR_UVCLAMP_UV will disable + the mirroring behavior. @{ */ #define PVR_UVFLIP_NONE 0 /**< \brief No flipped coordinates */ @@ -428,6 +440,11 @@ typedef struct { /** @} */ /** \defgroup pvr_uv_clamp Enable or disable clamping of U/V on the PVR + + These flags determine whether clamping will be applied to U/V coordinate + values that exceed 1.0. If enabled, these modes will explicitly override the + flip/mirroring modes (PVR_UVFLIP_U, PVR_UVFLIP_V, and PVR_UVFLIP_UV), and + will instead ensure that the coordinate(s) in question never exceed 1.0. @{ */ #define PVR_UVCLAMP_NONE 0 /**< \brief Disable clamping */ hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2015-06-09 03:32:13
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 2d702cd695697ad0e51bdd4c3eaab591e1c98b98 (commit) from d71acc5d7eba167c85758ca71ae3aff38bb820f4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 2d702cd695697ad0e51bdd4c3eaab591e1c98b98 Author: Lawrence Sebald <ljs...@us...> Date: Mon Jun 8 23:31:53 2015 -0400 Remove another stray binary. ----------------------------------------------------------------------- Summary of changes: utils/genromfs/genromfs.exe | Bin 75591 -> 0 bytes 1 files changed, 0 insertions(+), 0 deletions(-) delete mode 100755 utils/genromfs/genromfs.exe diff --git a/utils/genromfs/genromfs.exe b/utils/genromfs/genromfs.exe deleted file mode 100755 index 051a1f3..0000000 Binary files a/utils/genromfs/genromfs.exe and /dev/null differ hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2015-06-09 03:30:01
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via d71acc5d7eba167c85758ca71ae3aff38bb820f4 (commit) from ded7e3be319b3801787cb75ec7781c21d3ab0f33 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d71acc5d7eba167c85758ca71ae3aff38bb820f4 Author: Lawrence Sebald <ljs...@us...> Date: Mon Jun 8 23:29:35 2015 -0400 Remove stray binary file... ----------------------------------------------------------------------- Summary of changes: utils/scramble/scramble.exe | Bin 64155 -> 0 bytes 1 files changed, 0 insertions(+), 0 deletions(-) delete mode 100755 utils/scramble/scramble.exe diff --git a/utils/scramble/scramble.exe b/utils/scramble/scramble.exe deleted file mode 100755 index a12cfe0..0000000 Binary files a/utils/scramble/scramble.exe and /dev/null differ hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2015-05-30 16:16:11
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via ded7e3be319b3801787cb75ec7781c21d3ab0f33 (commit) via 270b7a1c602f76e6f722d8b34456735c3b335cd7 (commit) from c4329ef246dd10f10c25c5d9cb8e7c33f748cbf7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ded7e3be319b3801787cb75ec7781c21d3ab0f33 Author: Lawrence Sebald <ljs...@us...> Date: Sat May 30 12:15:37 2015 -0400 Add support for Spanish keyboards. Thanks to Xavier Vallejo for mapping them out! commit 270b7a1c602f76e6f722d8b34456735c3b335cd7 Author: Lawrence Sebald <ljs...@us...> Date: Sat May 30 11:55:25 2015 -0400 Update copyright date in banner. ----------------------------------------------------------------------- Summary of changes: doc/CHANGELOG | 1 + kernel/arch/dreamcast/hardware/maple/keyboard.c | 86 +++++++++++++++++++- kernel/arch/dreamcast/include/dc/maple/keyboard.h | 8 ++- kernel/arch/dreamcast/kernel/banner.c | 2 +- 4 files changed, 89 insertions(+), 8 deletions(-) diff --git a/doc/CHANGELOG b/doc/CHANGELOG index 7b2b624..fb6a185 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -70,6 +70,7 @@ KallistiOS version 2.1.0 ----------------------------------------------- - DC Minor cleanups to the flashrom code [DH && LS] - DC Added light gun support roughly based on how it is done in libronin [LS] - DC Added a very simple light gun example [LS] +- DC Added support for Spanish keyboards [Xavier Vallejo == XV] KallistiOS version 2.0.0 ----------------------------------------------- - DC Broadband Adapter driver fixes [Dan Potter == DP] diff --git a/kernel/arch/dreamcast/hardware/maple/keyboard.c b/kernel/arch/dreamcast/hardware/maple/keyboard.c index 9aa2bed..1f522a6 100644 --- a/kernel/arch/dreamcast/hardware/maple/keyboard.c +++ b/kernel/arch/dreamcast/hardware/maple/keyboard.c @@ -21,7 +21,7 @@ repeat handling. */ /* Built-in keymaps. */ -#define KBD_NUM_KEYMAPS 4 +#define KBD_NUM_KEYMAPS 8 static kbd_keymap_t keymaps[KBD_NUM_KEYMAPS] = { { /* Japanese keyboard */ @@ -169,7 +169,8 @@ static kbd_keymap_t keymaps[KBD_NUM_KEYMAPS] = { }, { /* German/QWERTZ keyboard */ - /* The hex values in the tables are the ISO8859-1 represention of the German special chars. */ + /* The hex values in the tables are the ISO-8859-15 represention of the + German special chars. */ { /* Base values */ 0, 0, 0, 0, 'a', 'b', 'c', 'd', /* 0x00 - 0x07 */ @@ -222,6 +223,82 @@ static kbd_keymap_t keymaps[KBD_NUM_KEYMAPS] = { /* All the rest are unused, and will be 0. */ } }, + { + /* French/AZERTY keyboard, probably. This one needs to be confirmed + still. */ + { }, + { }, + { } + }, + { + /* Italian/QWERTY keyboard, probably. This one needs to be confirmed + still. */ + { }, + { }, + { } + }, + { + /* ES (Spanish QWERTY) keyboard */ + /* The hex values in the tables are the ISO-8859-15 (Euro revision) + represention of the Spanish special chars. */ + { + /* Base values */ + /* 0xa1: '¡', 0xba: 'º', 0xb4: '´', 0xe7: 'ç', + 0xf1: 'ñ' */ + 0, 0, 0, 0, 'a', 'b', 'c', 'd', /* 0x00 - 0x07 */ + 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', /* 0x08 - 0x0F */ + 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', /* 0x10 - 0x17 */ + 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', /* 0x18 - 0x1F */ + '3', '4', '5', '6', '7', '8', '9', '0', /* 0x20 - 0x27 */ + 10, 27, 8, 9, ' ', '\'', 0xa1, '`', /* 0x28 - 0x2F */ + '+', 0, 0xe7, 0xf1, 0xb4, 0xba, ',', '.', /* 0x30 - 0x37 */ + '-', 0, 0, 0, 0, 0, 0, 0, /* 0x38 - 0x3F */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40 - 0x47 */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 0x48 - 0x4F */ + 0, 0, 0, 0, '/', '*', '-', '+', /* 0x50 - 0x57 */ + 13, '1', '2', '3', '4', '5', '6', '7', /* 0x58 - 0x5F */ + '8', '9', '0', '.', '<', 0, 0, 0, /* 0x60 - 0x65 */ + /* All the rest are unused, and will be 0. */ + }, + { + /* Shifted values */ + /* 0xaa: 'ª', 0xb7: '·', 0xbf: '¿', 0xc7: 'Ã', + 0xd1: 'Ã', 0xa8: '¨' */ + 0, 0, 0, 0, 'A', 'B', 'C', 'D', /* 0x00 - 0x07 */ + 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', /* 0x08 - 0x0F */ + 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', /* 0x10 - 0x17 */ + 'U', 'V', 'W', 'X', 'Y', 'Z', '!', '"', /* 0x18 - 0x1F */ + 0xb7, '$', '%', '&', '/', '(', ')', '=', /* 0x20 - 0x27 */ + 10, 27, 8, 9, ' ', '?', 0xbf, '^', /* 0x28 - 0x2F */ + '*', 0, 0xc7, 0xd1, 0xa8, 0xaa, ';', ':', /* 0x30 - 0x37 */ + '_', 0, 0, 0, 0, 0, 0, 0, /* 0x38 - 0x3F */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40 - 0x47 */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 0x48 - 0x4F */ + 0, 0, 0, 0, '/', '*', '-', '+', /* 0x50 - 0x57 */ + 13, '1', '2', '3', '4', '5', '6', '7', /* 0x58 - 0x5F */ + '8', '9', '0', '.', '>', 0, 0, 0, /* 0x60 - 0x65 */ + /* All the rest are unused, and will be 0. */ + }, + { + /* "Alt" shifted values */ + /* 0xa4: 'â¬', 0xac: '¬' */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00 - 0x07 */ + 0xa4, 0, 0, 0, 0, 0, 0, 0, /* 0x08 - 0x0F */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10 - 0x17 */ + 0, 0, 0, 0, 0, 0, '|', '@', /* 0x18 - 0x1F */ + '#', 0, 0, 0xac, 0, 0, 0, 0, /* 0x20 - 0x27 */ + 0, 0, 0, 0, 0, 0, 0, '[', /* 0x28 - 0x2F */ + ']', 0, '}', 0, '{', '\\', 0, 0, /* 0x30 - 0x37 */ + '-', 0, 0, 0, 0, 0, 0, 0, /* 0x38 - 0x3F */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40 - 0x47 */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 0x48 - 0x4F */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50 - 0x57 */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 0x58 - 0x5F */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x65 */ + /* All the rest are unused, and will be 0. */ + } + + } }; @@ -342,7 +419,7 @@ int kbd_queue_pop(maple_device_t *dev, int xlat) { mods = rv >> 8; - if(mods & KBD_MOD_RALT || (mods & (KBD_MOD_LCTRL | KBD_MOD_LALT)) == (KBD_MOD_LCTRL | KBD_MOD_LALT)) + if((mods & KBD_MOD_RALT) || (mods & (KBD_MOD_LCTRL | KBD_MOD_LALT)) == (KBD_MOD_LCTRL | KBD_MOD_LALT)) ascii = keymaps[state->region - 1].alt[(uint8)rv]; else if(mods & (KBD_MOD_LSHIFT | KBD_MOD_RSHIFT | (1 << 9))) ascii = keymaps[state->region - 1].shifted[(uint8)rv]; @@ -357,8 +434,7 @@ int kbd_queue_pop(maple_device_t *dev, int xlat) { /* Update the keyboard status; this will handle debounce handling as well as queueing keypresses for later usage. The key press queue uses 16-bit - words so that we can store "special" keys as such. This needs to be called - fairly periodically if you're expecting keyboard input. */ + words so that we can store "special" keys as such. */ static void kbd_check_poll(maple_frame_t *frm) { kbd_state_t *state; kbd_cond_t *cond; diff --git a/kernel/arch/dreamcast/include/dc/maple/keyboard.h b/kernel/arch/dreamcast/include/dc/maple/keyboard.h index 3c66af2..5751846 100644 --- a/kernel/arch/dreamcast/include/dc/maple/keyboard.h +++ b/kernel/arch/dreamcast/include/dc/maple/keyboard.h @@ -59,6 +59,9 @@ __BEGIN_DECLS This is the list of keys that are on the keyboard that may be pressed. The keyboard returns keys in this format. + + These are the raw keycodes returned by the US keyboard, and thus only cover + the keys on US keyboards. @{ */ #define KBD_KEY_NONE 0x00 @@ -171,6 +174,9 @@ __BEGIN_DECLS #define KBD_REGION_US 2 /**< \brief US keyboard */ #define KBD_REGION_UK 3 /**< \brief UK keyboard */ #define KBD_REGION_DE 4 /**< \brief German keyboard */ +#define KBD_REGION_FR 5 /**< \brief French keyboard (not supported yet) */ +#define KBD_REGION_IT 6 /**< \brief Italian keyboard (not supported yet) */ +#define KBD_REGION_ES 7 /**< \brief Spanish keyboard */ /** @} */ /** \brief Size of a keyboard queue. @@ -320,5 +326,3 @@ void kbd_shutdown(); __END_DECLS #endif /* __DC_MAPLE_KEYBOARD_H */ - - diff --git a/kernel/arch/dreamcast/kernel/banner.c b/kernel/arch/dreamcast/kernel/banner.c index 333b43a..2843462 100644 --- a/kernel/arch/dreamcast/kernel/banner.c +++ b/kernel/arch/dreamcast/kernel/banner.c @@ -8,7 +8,7 @@ #include "authors.h" static const char license[] = -"Copyright (C) 1997-2014 KallistiOS Contributors. All rights reserved.\n" +"Copyright (C) 1997-2015 KallistiOS Contributors. All rights reserved.\n" "\n" "Redistribution and use in source and binary forms, with or without\n" "modification, are permitted provided that the following conditions\n" hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2015-05-24 01:40:53
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via c4329ef246dd10f10c25c5d9cb8e7c33f748cbf7 (commit) from 0b7839e9b1a94e59fb4d9987fd419f1cfa914819 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit c4329ef246dd10f10c25c5d9cb8e7c33f748cbf7 Author: Lawrence Sebald <ljs...@us...> Date: Sat May 23 21:40:28 2015 -0400 Add a very basic light gun example. ----------------------------------------------------------------------- Summary of changes: doc/CHANGELOG | 5 +- examples/dreamcast/Makefile | 6 +- examples/dreamcast/{lua => lightgun}/Makefile | 7 +- .../{parallax/sinus => lightgun/basic}/Makefile | 17 ++-- examples/dreamcast/lightgun/basic/lightgun.c | 99 ++++++++++++++++++++ 5 files changed, 116 insertions(+), 18 deletions(-) copy examples/dreamcast/{lua => lightgun}/Makefile (68%) copy examples/dreamcast/{parallax/sinus => lightgun/basic}/Makefile (50%) create mode 100644 examples/dreamcast/lightgun/basic/lightgun.c diff --git a/doc/CHANGELOG b/doc/CHANGELOG index fb522b5..7b2b624 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -66,9 +66,10 @@ KallistiOS version 2.1.0 ----------------------------------------------- unlock a mutex as if it were a specified thread [LS] - DC Fixed a deadlock issue in the G1ATA code related to the use of a recursive mutex for locking -- Thanks to SWAT for noticing the issue [LS] -- DC Add support for German (DE) and UK keyboards [Christian Groessler == CG] +- DC Added support for German (DE) and UK keyboards [Christian Groessler == CG] - DC Minor cleanups to the flashrom code [DH && LS] -- DC Add light gun support roughly based on how it is done in libronin [LS] +- DC Added light gun support roughly based on how it is done in libronin [LS] +- DC Added a very simple light gun example [LS] KallistiOS version 2.0.0 ----------------------------------------------- - DC Broadband Adapter driver fixes [Dan Potter == DP] diff --git a/examples/dreamcast/Makefile b/examples/dreamcast/Makefile index 020b437..22080ec 100644 --- a/examples/dreamcast/Makefile +++ b/examples/dreamcast/Makefile @@ -5,7 +5,7 @@ # DIRS = 2ndmix basic libdream kgl hello sound png network vmu conio pvr video \ - lua parallax modem dreameye sd g1ata + lua parallax modem dreameye sd g1ata lightgun ifdef KOS_CCPLUS DIRS += cpp tsunami endif @@ -15,8 +15,6 @@ all: clean: for i in $(DIRS); do $(KOS_MAKE) -C $$i clean || exit -1; done - + dist: for i in $(DIRS); do $(KOS_MAKE) -C $$i dist || exit -1; done - - diff --git a/examples/dreamcast/lua/Makefile b/examples/dreamcast/lightgun/Makefile similarity index 68% copy from examples/dreamcast/lua/Makefile copy to examples/dreamcast/lightgun/Makefile index 4ce6c80..4a2684b 100644 --- a/examples/dreamcast/lua/Makefile +++ b/examples/dreamcast/lightgun/Makefile @@ -1,7 +1,6 @@ # KallistiOS ##version## # -# examples/dreamcast/lua/Makefile -# (c)2002 Dan Potter +# examples/dreamcast/lightgun/Makefile # all: @@ -9,8 +8,6 @@ all: clean: $(KOS_MAKE) -C basic clean - + dist: $(KOS_MAKE) -C basic dist - - diff --git a/examples/dreamcast/parallax/sinus/Makefile b/examples/dreamcast/lightgun/basic/Makefile similarity index 50% copy from examples/dreamcast/parallax/sinus/Makefile copy to examples/dreamcast/lightgun/basic/Makefile index 6105a34..f5fcb12 100644 --- a/examples/dreamcast/parallax/sinus/Makefile +++ b/examples/dreamcast/lightgun/basic/Makefile @@ -1,10 +1,15 @@ -TARGET = sinus.elf -OBJS = sinus.o +# KallistiOS ##version## +# +# lightgun/basic/Makefile +# -all: rm-elf $(TARGET) +all: rm-elf lightgun.elf include $(KOS_BASE)/Makefile.rules +TARGET = lightgun.elf +OBJS = lightgun.o + clean: -rm -f $(TARGET) $(OBJS) @@ -12,13 +17,11 @@ rm-elf: -rm -f $(TARGET) $(TARGET): $(OBJS) - $(KOS_CC) $(KOS_CFLAGS) $(KOS_LDFLAGS) -o $(TARGET) $(KOS_START) \ - $(OBJS) $(OBJEXTRA) -lparallax -lm $(KOS_LIBS) + kos-cc -o $(TARGET) $(OBJS) $(DATAOBJS) $(OBJEXTRA) run: $(TARGET) $(KOS_LOADER) $(TARGET) dist: - rm -f $(OBJS) + -rm -f $(OBJS) $(KOS_STRIP) $(TARGET) - diff --git a/examples/dreamcast/lightgun/basic/lightgun.c b/examples/dreamcast/lightgun/basic/lightgun.c new file mode 100644 index 0000000..532ec03 --- /dev/null +++ b/examples/dreamcast/lightgun/basic/lightgun.c @@ -0,0 +1,99 @@ +/* KallistiOS ##version## + + lightgun.c + Copyright (C) 2015 Lawrence Sebald +*/ + +#include <stdio.h> + +#include <kos/dbgio.h> +#include <arch/timer.h> + +#include <dc/biosfont.h> +#include <dc/maple.h> +#include <dc/maple/controller.h> +#include <dc/pvr.h> +#include <dc/video.h> + +/* This little example isn't exactly anything fancy, but it does demonstrate the + basics of getting the light gun up and running. + + Some things to note about using the light gun: + 1. Things work better if the player is aiming at a very bright section of the + screen. That's why this example blanks the screen to white (only using + black where it draws text). I'd suggest having at least one frame of a + bright color before polling the gun, plus one frame while you're polling + it. That way you take care of any interlacing effects. + 2. The light gun will (of course) only work with CRT televisions or monitors. + 3. You can only poll one gun at a time. This is a hardware limitation. You + can switch back and forth between guns, but only one can actively be + reading its position at a time. + 4. The light gun itself only returns data as if it were a normal controller. + The trigger is mapped to the A button and you also have the D-Pad, B, and + Start buttons, generally. +*/ + +int main(int argc, char *argv[]) { + int x, y, gun = 0; + maple_device_t *dev; + cont_state_t *state; + uint64 last = 0, now; + + /* Do any printing to the screen and make it be black text on a white + background (as much as we can anyway). I should eventually make it so you + can specify this in fb_console... */ + dbgio_dev_select("fb"); + bfont_set_foreground_color(0x00000000); + bfont_set_background_color(0xFFFFFFFF); + pvr_init_defaults(); + + /* Blank the whole screen to white. */ + for(y = 0; y < 480; ++y) { + for(x = 0; x < 640; ++x) { + vram_s[y * 640 + x] = 0xFFFF; + } + } + + for(;;) { + /* Wait for vblank... */ + vid_waitvbl(); + now = timer_ms_gettime64(); + + /* Blank the "play" area of the screen to white. */ + for(y = 0; y < 480; ++y) { + for(x = 128; x < 640; ++x) { + vram_s[y * 640 + x] = 0xFFFF; + } + } + + /* Did we hit the trigger last frame? If so, grab the counter values and + print them out to the screen. */ + if(gun) { + maple_gun_read_pos(&x, &y); + printf("%d %d\n", x, y); + gun = 0; + } + + /* Grab the light gun and poll it for whether any interesting buttons + are pressed. */ + if((dev = maple_enum_type(0, MAPLE_FUNC_LIGHTGUN))) { + /* The light gun "status" is just that of its buttons. The data for + positioning actually is read from a video register... */ + if((state = (cont_state_t *)maple_dev_status(dev))) { + /* Exit if the user pressed start. */ + if((state->buttons & CONT_START)) + break; + + /* The light gun's trigger is mapped to the A button. See if the + user is pulling the trigger and enable the gun if needed. */ + if((state->buttons & CONT_A) && last + 200 < now) { + maple_gun_enable(dev->port); + last = now; + gun = 1; + } + } + } + } + + return 0; +} hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2015-05-24 00:59:17
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 0b7839e9b1a94e59fb4d9987fd419f1cfa914819 (commit) from 4e4fbd89feddd163223f461d44b7f00c36c1b4f4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 0b7839e9b1a94e59fb4d9987fd419f1cfa914819 Author: Lawrence Sebald <ljs...@us...> Date: Sat May 23 20:58:52 2015 -0400 A few minor documentation updates... ----------------------------------------------------------------------- Summary of changes: doc/CHANGELOG | 2 +- doc/README | 6 ++++-- doc/RELNOTES | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/doc/CHANGELOG b/doc/CHANGELOG index e126fae..fb522b5 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -4,7 +4,7 @@ is responsible for the change are listed in [square brackets] for most versions (where they are missing from early versions, assume that they should be attributed to Dan Potter). -KallistiOS version 2.0.1 ----------------------------------------------- +KallistiOS version 2.1.0 ----------------------------------------------- - *** Cleaned up generated stubs files on a make clean [Lawrence Sebald = LS] - DC Added a function to detect if the program is being run on a retail Dreamcast or a Set5.xx device [LS] diff --git a/doc/README b/doc/README index b058da5..2cdb9d3 100644 --- a/doc/README +++ b/doc/README @@ -79,7 +79,7 @@ of the software distributed with KOS (newlib math routines, Xing MP3 engine, modplug, etc) are under different licenses. Please read "LICENSE" if in doubt! -This software is optinoally based in part on the work of the Independent JPEG +This software is optionally based in part on the work of the Independent JPEG Group (see addons/libjpeg/README). I have also added a somewhat informative "licensing" section to the FAQ. @@ -94,7 +94,9 @@ Building KallistiOS from source entirely requires two things: - GNU Binutils / GCC, cross-compile to the platform of your choice; for DC this is a compiler targeted for "sh-elf", as well as (optionally) a compiler targeted for "arm-eabi". See below about version notes. -- GNU Binutils / GCC / GNU Make for your host platform +- A working compiler toolchain that can be used to cross-compile the + requisite target toolchain (so GCC or Clang based, basically) and + GNU Make for your host platform For the Dreamcast version, a Makefile is provided to build the requisite GCC, Binutils, and Newlib versions in the utils/dc-chain directory. diff --git a/doc/RELNOTES b/doc/RELNOTES index 91424e2..52bb7a7 100644 --- a/doc/RELNOTES +++ b/doc/RELNOTES @@ -2,7 +2,7 @@ KallistiOS ##version## Copyright (C) 2002, 2003 Dan Potter Copyright (C) 2012-2015 Lawrence Sebald -RELEASE NOTES for 2.0.1 +RELEASE NOTES for 2.1.0 ----------------------- There are a lot less major changes in this release than in the previous one, that is for sure. Of course, this isn't to say that there hasn't been some hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2015-05-23 03:14:16
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 4e4fbd89feddd163223f461d44b7f00c36c1b4f4 (commit) via 3acd60acdd0fa130ac3b59bbc36621a4f5a932be (commit) from ad8fbb323816c822f4c9143b26ad20f62f6d37ef (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4e4fbd89feddd163223f461d44b7f00c36c1b4f4 Author: Lawrence Sebald <ljs...@us...> Date: Fri May 22 23:13:11 2015 -0400 Add in lightgun support. One more odd piece of hardware supported -- even if very few people can still make use of it... commit 3acd60acdd0fa130ac3b59bbc36621a4f5a932be Author: Lawrence Sebald <ljs...@us...> Date: Fri May 22 19:49:00 2015 -0400 That is not the mouse driver. Fix the comment in it. ----------------------------------------------------------------------- Summary of changes: doc/CHANGELOG | 1 + kernel/arch/dreamcast/hardware/maple/Makefile | 9 +-- kernel/arch/dreamcast/hardware/maple/lightgun.c | 35 ++++++++++++++ .../dreamcast/hardware/maple/maple_init_shutdown.c | 8 ++- kernel/arch/dreamcast/hardware/maple/maple_irq.c | 12 ++++- kernel/arch/dreamcast/hardware/maple/maple_queue.c | 17 ++++++- kernel/arch/dreamcast/hardware/maple/maple_utils.c | 21 ++++++++- kernel/arch/dreamcast/hardware/maple/purupuru.c | 2 +- kernel/arch/dreamcast/include/dc/maple.h | 49 ++++++++++++++++++++ kernel/arch/dreamcast/include/dc/maple/lightgun.h | 32 +++++++++++++ 10 files changed, 173 insertions(+), 13 deletions(-) create mode 100644 kernel/arch/dreamcast/hardware/maple/lightgun.c create mode 100644 kernel/arch/dreamcast/include/dc/maple/lightgun.h diff --git a/doc/CHANGELOG b/doc/CHANGELOG index 4a516ea..e126fae 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -68,6 +68,7 @@ KallistiOS version 2.0.1 ----------------------------------------------- mutex for locking -- Thanks to SWAT for noticing the issue [LS] - DC Add support for German (DE) and UK keyboards [Christian Groessler == CG] - DC Minor cleanups to the flashrom code [DH && LS] +- DC Add light gun support roughly based on how it is done in libronin [LS] KallistiOS version 2.0.0 ----------------------------------------------- - DC Broadband Adapter driver fixes [Dan Potter == DP] diff --git a/kernel/arch/dreamcast/hardware/maple/Makefile b/kernel/arch/dreamcast/hardware/maple/Makefile index 9abfe3b..c087288 100644 --- a/kernel/arch/dreamcast/hardware/maple/Makefile +++ b/kernel/arch/dreamcast/hardware/maple/Makefile @@ -1,7 +1,7 @@ # KallistiOS ##version## # # arch/dreamcast/hardware/maple/Makefile -# (c)2000-2001 Dan Potter +# Copyright (C) 2000-2001 Dan Potter # # Core maple handling stuff @@ -10,8 +10,8 @@ OBJS := $(OBJS) maple_init_shutdown.o maple_irq.o OBJS := $(OBJS) maple_queue.o maple_utils.o # Various input devices -OBJS := $(OBJS) controller.o keyboard.o mouse.o -OBJS := $(OBJS) purupuru.o sip.o dreameye.o +OBJS := $(OBJS) controller.o keyboard.o mouse.o +OBJS := $(OBJS) purupuru.o sip.o dreameye.o lightgun.o # Output devices OBJS := $(OBJS) vmu.o @@ -19,6 +19,3 @@ OBJS := $(OBJS) vmu.o SUBDIRS = include $(KOS_BASE)/Makefile.prefab - - - diff --git a/kernel/arch/dreamcast/hardware/maple/lightgun.c b/kernel/arch/dreamcast/hardware/maple/lightgun.c new file mode 100644 index 0000000..59fa018 --- /dev/null +++ b/kernel/arch/dreamcast/hardware/maple/lightgun.c @@ -0,0 +1,35 @@ +/* KallistiOS ##version## + + lightgun.c + Copyright (C) 2015 Lawrence Sebald +*/ + +#include <assert.h> +#include <kos/dbglog.h> +#include <kos/genwait.h> +#include <dc/maple.h> +#include <dc/maple/lightgun.h> + +static int lightgun_attach(maple_driver_t *drv, maple_device_t *dev) { + (void)drv; + dev->status_valid = 1; + return 0; +} + +/* Device Driver Struct */ +static maple_driver_t lightgun_drv = { + .functions = MAPLE_FUNC_LIGHTGUN, + .name = "Lightgun", + .periodic = NULL, + .attach = lightgun_attach, + .detach = NULL +}; + +/* Add the lightgun to the driver chain */ +int lightgun_init(void) { + return maple_driver_reg(&lightgun_drv); +} + +void lightgun_shutdown(void) { + maple_driver_unreg(&lightgun_drv); +} diff --git a/kernel/arch/dreamcast/hardware/maple/maple_init_shutdown.c b/kernel/arch/dreamcast/hardware/maple/maple_init_shutdown.c index 6c1c127..958c0b8 100644 --- a/kernel/arch/dreamcast/hardware/maple/maple_init_shutdown.c +++ b/kernel/arch/dreamcast/hardware/maple/maple_init_shutdown.c @@ -1,7 +1,7 @@ /* KallistiOS ##version## maple_init.c - (c)2002 Dan Potter + Copyright (C) 2002 Dan Potter */ #include <malloc.h> @@ -19,6 +19,7 @@ #include <dc/maple/purupuru.h> #include <dc/maple/sip.h> #include <dc/maple/dreameye.h> +#include <dc/maple/lightgun.h> /* This system handles low-level communication/initialization of the maple @@ -81,6 +82,8 @@ int maple_hw_init() { maple_state.detect_port_next = 0; maple_state.detect_unit_next = 0; maple_state.detect_wrapped = 0; + maple_state.gun_port = -1; + maple_state.gun_x = maple_state.gun_y = -1; /* Reset hardware */ maple_write(MAPLE_RESET1, MAPLE_RESET1_MAGIC); @@ -168,6 +171,7 @@ void maple_wait_scan() { /* Full init: initialize known drivers and start maple operations */ int maple_init() { + lightgun_init(); cont_init(); kbd_init(); mouse_init(); @@ -190,5 +194,5 @@ void maple_shutdown() { mouse_shutdown(); kbd_shutdown(); cont_shutdown(); + lightgun_shutdown(); } - diff --git a/kernel/arch/dreamcast/hardware/maple/maple_irq.c b/kernel/arch/dreamcast/hardware/maple/maple_irq.c index 3100420..36bcb55 100644 --- a/kernel/arch/dreamcast/hardware/maple/maple_irq.c +++ b/kernel/arch/dreamcast/hardware/maple/maple_irq.c @@ -2,6 +2,7 @@ maple_irq.c Copyright (C) 2002 Dan Potter + Copyright (C) 2015 Lawrence Sebald */ #include <malloc.h> @@ -10,6 +11,7 @@ #include <assert.h> #include <dc/maple.h> #include <dc/asic.h> +#include <dc/pvr.h> #include <kos/thread.h> /*********************************************************************/ @@ -199,6 +201,7 @@ void maple_vbl_irq_hnd(uint32 code) { void maple_dma_irq_hnd(uint32 code) { maple_frame_t *i; int8 resp; + uint32 gun; (void)code; @@ -248,6 +251,13 @@ void maple_dma_irq_hnd(uint32 code) { maple_frame_unlock(i); } + /* If gun mode is enabled, read the latched H/V counter values. */ + if(maple_state.gun_port > -1) { + gun = PVR_GET(PVR_GUN_POS); + maple_state.gun_x = gun & 0x3ff; + maple_state.gun_y = (gun >> 16) & 0x3ff; + maple_state.gun_port = -1; + } + /* dbgio_write_str("finish dma_irq_hnd\n"); */ } - diff --git a/kernel/arch/dreamcast/hardware/maple/maple_queue.c b/kernel/arch/dreamcast/hardware/maple/maple_queue.c index 349be78..0ddae31 100644 --- a/kernel/arch/dreamcast/hardware/maple/maple_queue.c +++ b/kernel/arch/dreamcast/hardware/maple/maple_queue.c @@ -1,7 +1,8 @@ /* KallistiOS ##version## maple_queue.c - (c)2002 Dan Potter + Copyright (C) 2002 Dan Potter + Copyright (C) 2015 Lawrence Sebald */ #include <stdio.h> @@ -20,6 +21,10 @@ void maple_queue_flush() { out = (uint32 *)maple_state.dma_buffer; last = NULL; + /* Make sure we end up with space for the gun enable command... */ + if(maple_state.gun_port > -1) + amt = 12; + /* Go through and process each frame... */ TAILQ_FOREACH(i, &maple_state.frame_queue, frameq) { /* Are we running out of space? */ @@ -57,6 +62,15 @@ void maple_queue_flush() { amt += i->length * 4; } + /* Are we entering gun mode this frame? */ + if(maple_state.gun_port > -1) { + last = out; + *out++ = 0x200 | (maple_state.gun_port << 16); + *out++ = 0; + *out++ = 0; + cnt++; + } + /* Did we actually do anything...? */ if(cnt > 0) { /* Tack on the "last" bit to the last one */ @@ -190,4 +204,3 @@ void maple_frame_unlock(maple_frame_t *frame) { assert(frame->state == MAPLE_FRAME_RESPONDED); frame->state = MAPLE_FRAME_VACANT; } - diff --git a/kernel/arch/dreamcast/hardware/maple/maple_utils.c b/kernel/arch/dreamcast/hardware/maple/maple_utils.c index 0c470d7..366ec7f 100644 --- a/kernel/arch/dreamcast/hardware/maple/maple_utils.c +++ b/kernel/arch/dreamcast/hardware/maple/maple_utils.c @@ -1,7 +1,8 @@ /* KallistiOS ##version## maple_util.c - (c)2002 Dan Potter + Copyright (C) 2002 Dan Potter + Copyright (C) 2015 Lawrence Sebald */ #include <assert.h> @@ -148,6 +149,24 @@ int maple_dev_valid(int p, int u) { return maple_state.ports[p].units[u].valid; } +int maple_gun_enable(int port) { + if(port >= 0 && port < 4) { + maple_state.gun_port = port; + return MAPLE_EOK; + } + + return MAPLE_EFAIL; +} + +void maple_gun_disable(void) { + maple_state.gun_port = -1; +} + +void maple_gun_read_pos(int *x, int *y) { + *x = maple_state.gun_x; + *y = maple_state.gun_y; +} + #if MAPLE_DMA_DEBUG /* Debugging help */ void maple_sentinel_setup(void * buffer, int bufsize) { diff --git a/kernel/arch/dreamcast/hardware/maple/purupuru.c b/kernel/arch/dreamcast/hardware/maple/purupuru.c index 6aaa590..41fd5ff 100644 --- a/kernel/arch/dreamcast/hardware/maple/purupuru.c +++ b/kernel/arch/dreamcast/hardware/maple/purupuru.c @@ -119,7 +119,7 @@ static maple_driver_t purupuru_drv = { .detach = NULL }; -/* Add the mouse to the driver chain */ +/* Add the purupuru to the driver chain */ int purupuru_init() { return maple_driver_reg(&purupuru_drv); } diff --git a/kernel/arch/dreamcast/include/dc/maple.h b/kernel/arch/dreamcast/include/dc/maple.h index b8d0ec9..1899051 100644 --- a/kernel/arch/dreamcast/include/dc/maple.h +++ b/kernel/arch/dreamcast/include/dc/maple.h @@ -2,6 +2,7 @@ dc/maple.h Copyright (C) 2002 Dan Potter + Copyright (C) 2015 Lawrence Sebald This new driver's design is based loosely on the LinuxDC maple bus driver. @@ -355,6 +356,15 @@ typedef struct maple_state_str { /** \brief Our vblank handler handle */ int vbl_handle; + + /** \brief The port to read for lightgun status, if any. */ + int gun_port; + + /** \brief The horizontal position of the lightgun signal. */ + int gun_x; + + /** \brief The vertical position of the lightgun signal. */ + int gun_y; } maple_state_t; /** \brief Maple DMA buffer size. @@ -477,6 +487,45 @@ const char * maple_perror(int response); */ int maple_dev_valid(int p, int u); +/** \brief Enable light gun mode for this frame. + + This function enables light gun processing for the current frame of data. + Light gun mode will automatically be disabled when the data comes back for + this frame. + + \param port The port to enable light gun mode on. + \return MAPLE_EOK on success, MAPLE_EFAIL on error. +*/ +int maple_gun_enable(int port); + +/** \brief Disable light gun mode. + + There is probably very little reason to call this function. Light gun mode + is ordinarily disabled and is automatically disabled after the data has been + read from the device. The only reason to call this function is if you call + the maple_gun_enable() function, and then change your mind during the same + frame. +*/ +void maple_gun_disable(void); + +/** \brief Read the light gun position values. + + This function fetches the gun position values from the video hardware and + returns them via the parameters. These values are not normalized before + returning. + + \param x Storage for the horizontal position of the gun. + \param y Storage for the vertical position of the gun. + + \note The values returned from this function are the raw H and V counter + values from the video hardware where the gun registered its + position. The values, however, need a bit of massaging before they + correspond nicely to screen values. The y value is particularly odd + in interlaced modes due to the fact that you really have half as + many physical lines on the screen as you might expect. +*/ +void maple_gun_read_pos(int *x, int *y); + #if MAPLE_DMA_DEBUG /* Debugging help */ diff --git a/kernel/arch/dreamcast/include/dc/maple/lightgun.h b/kernel/arch/dreamcast/include/dc/maple/lightgun.h new file mode 100644 index 0000000..d6cbc6e --- /dev/null +++ b/kernel/arch/dreamcast/include/dc/maple/lightgun.h @@ -0,0 +1,32 @@ +/* KallistiOS ##version## + + dc/maple/lightgun.h + Copyright (C) 2015 Lawrence Sebald + +*/ + +/** \file dc/maple/lightgun.h + \brief Definitions for using the light gun. + + This file contains the definitions needed to access maple light gun devices. + There's really no user-serviceable parts in here, as there's very little to + this driver. + + \author Lawrence Sebald +*/ + +#ifndef __DC_MAPLE_LIGHTGUN_H +#define __DC_MAPLE_LIGHTGUN_H + +#include <sys/cdefs.h> +__BEGIN_DECLS + +/* \cond */ +/* Init / Shutdown */ +int lightgun_init(void); +void lightgun_shutdown(void); +/* \endcond */ + +__END_DECLS + +#endif /* __DC_MAPLE_LIGHTGUN_H */ hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2015-05-21 03:17:47
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via ad8fbb323816c822f4c9143b26ad20f62f6d37ef (commit) from 01adb7890a110ccbe4d5c420177f6330804ae2f7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ad8fbb323816c822f4c9143b26ad20f62f6d37ef Author: Lawrence Sebald <ljs...@us...> Date: Wed May 20 23:17:14 2015 -0400 Oops, I meant Donald Haase there, not Harley Laue. Sorry about the noise. ----------------------------------------------------------------------- Summary of changes: doc/CHANGELOG | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/doc/CHANGELOG b/doc/CHANGELOG index 5ca7b5d..4a516ea 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -67,7 +67,7 @@ KallistiOS version 2.0.1 ----------------------------------------------- - DC Fixed a deadlock issue in the G1ATA code related to the use of a recursive mutex for locking -- Thanks to SWAT for noticing the issue [LS] - DC Add support for German (DE) and UK keyboards [Christian Groessler == CG] -- DC Minor cleanups to the flashrom code [Harley Laue == HL && LS] +- DC Minor cleanups to the flashrom code [DH && LS] KallistiOS version 2.0.0 ----------------------------------------------- - DC Broadband Adapter driver fixes [Dan Potter == DP] hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2015-05-21 03:16:38
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 01adb7890a110ccbe4d5c420177f6330804ae2f7 (commit) from b1d4d7d62b04ab1507a962cf372e171e04a26f6d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 01adb7890a110ccbe4d5c420177f6330804ae2f7 Author: Lawrence Sebald <ljs...@us...> Date: Wed May 20 23:15:32 2015 -0400 Mostly apply Harley Laue's flashrom cleanup patch. This closes patch ticket #58. ----------------------------------------------------------------------- Summary of changes: doc/CHANGELOG | 1 + kernel/arch/dreamcast/hardware/flashrom.c | 70 +++++++++++++-------------- kernel/arch/dreamcast/include/dc/flashrom.h | 17 +++++++ 3 files changed, 51 insertions(+), 37 deletions(-) diff --git a/doc/CHANGELOG b/doc/CHANGELOG index fea4583..5ca7b5d 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -67,6 +67,7 @@ KallistiOS version 2.0.1 ----------------------------------------------- - DC Fixed a deadlock issue in the G1ATA code related to the use of a recursive mutex for locking -- Thanks to SWAT for noticing the issue [LS] - DC Add support for German (DE) and UK keyboards [Christian Groessler == CG] +- DC Minor cleanups to the flashrom code [Harley Laue == HL && LS] KallistiOS version 2.0.0 ----------------------------------------------- - DC Broadband Adapter driver fixes [Dan Potter == DP] diff --git a/kernel/arch/dreamcast/hardware/flashrom.c b/kernel/arch/dreamcast/hardware/flashrom.c index b76749b..9ca3e07 100644 --- a/kernel/arch/dreamcast/hardware/flashrom.c +++ b/kernel/arch/dreamcast/hardware/flashrom.c @@ -9,9 +9,6 @@ This module implements the stuff enumerated in flashrom.h. - Writing to the flash is disabled by default. To re-enable it, uncomment - the #define below. - Thanks to Marcus Comstedt for the info about the flashrom and syscalls. */ @@ -28,24 +25,27 @@ typedef int (*flashrom_sc)(int, void *, int, int); int flashrom_info(int part, int * start_out, int * size_out) { flashrom_sc sc = (flashrom_sc)(*((uint32 *)0x8c0000b8)); uint32 ptrs[2]; - int rv; + int old, rv; + + old = irq_disable(); - if(sc(part, ptrs, 0, 0) == 0) { + if(!(rv = sc(part, ptrs, 0, 0))) { *start_out = ptrs[0]; *size_out = ptrs[1]; - rv = 0; } - else - rv = -1; + + irq_restore(old); return rv; } int flashrom_read(int offset, void * buffer_out, int bytes) { flashrom_sc sc = (flashrom_sc)(*((uint32 *)0x8c0000b8)); - int rv; + int old, rv; + old = irq_disable(); rv = sc(offset, buffer_out, bytes, 1); + irq_restore(old); return rv; } @@ -78,7 +78,7 @@ int flashrom_delete(int offset) { static int flashrom_calc_crc(uint8 * buffer) { int i, c, n = 0xffff; - for(i = 0; i < 62; i++) { + for(i = 0; i < FLASHROM_OFFSET_CRC; i++) { n ^= buffer[i] << 8; for(c = 0; c < 8; c++) { @@ -96,25 +96,25 @@ static int flashrom_calc_crc(uint8 * buffer) { int flashrom_get_block(int partid, int blockid, uint8 * buffer_out) { int start, size; int bmcnt; - char magic[18]; - uint8 * bitmap; - int i, rv; + char magic[18]; + uint8 * bitmap; + int i; /* First, figure out where the partition is located. */ - if(flashrom_info(partid, &start, &size) < 0) - return -2; + if(flashrom_info(partid, &start, &size)) + return FLASHROM_ERR_NO_PARTITION; /* Verify the partition */ if(flashrom_read(start, magic, 18) < 0) { dbglog(DBG_ERROR, "flashrom_get_block: can't read part %d magic\n", partid); - return -3; + return FLASHROM_ERR_READ_PART; } if(strncmp(magic, "KATANA_FLASH____", 16) || *((uint16*)(magic + 16)) != partid) { bmcnt = *((uint16*)(magic + 16)); magic[16] = 0; dbglog(DBG_ERROR, "flashrom_get_block: invalid magic '%s' or id %d in part %d\n", magic, bmcnt, partid); - return -4; + return FLASHROM_ERR_BAD_MAGIC; } /* We need one bit per 64 bytes of partition size. Figure out how @@ -131,15 +131,16 @@ int flashrom_get_block(int partid, int blockid, uint8 * buffer_out) { /* This is messy but simple and safe... */ if(bmcnt > 65536) { dbglog(DBG_ERROR, "flashrom_get_block: bogus part %p/%d\n", (void *)start, size); - return -5; + return FLASHROM_ERR_BOGUS_PART; } - bitmap = (uint8 *)malloc(bmcnt); + if(!(bitmap = (uint8 *)malloc(bmcnt))) + return FLASHROM_ERR_NOMEM; if(flashrom_read(start + size - bmcnt, bitmap, bmcnt) < 0) { dbglog(DBG_ERROR, "flashrom_get_block: can't read part %d bitmap\n", partid); - rv = -6; - goto ex; + free(bitmap); + return FLASHROM_ERR_READ_BITMAP; } /* Go through all the allocated blocks, and look for the latest one @@ -155,12 +156,13 @@ int flashrom_get_block(int partid, int blockid, uint8 * buffer_out) { break; } + /* Done with the bitmap, free it. */ + free(bitmap); + /* All blocks unused -> file not found. Note that this is probably a very unusual condition. */ - if(i == 0) { - rv = -1; - goto ex; - } + if(i == 0) + return FLASHROM_ERR_EMPTY_PART; i--; /* 'i' was the first unused block, so back up one */ @@ -169,8 +171,7 @@ int flashrom_get_block(int partid, int blockid, uint8 * buffer_out) { _user_ block zero, which is physical block 1. */ if(flashrom_read(start + (i + 1) * 64, buffer_out, 64) < 0) { dbglog(DBG_ERROR, "flashrom_get_block: can't read part %d phys block %d\n", partid, i + 1); - rv = -6; - goto ex; + return FLASHROM_ERR_READ_BLOCK; } /* Does the block ID match? */ @@ -180,23 +181,18 @@ int flashrom_get_block(int partid, int blockid, uint8 * buffer_out) { /* Check the checksum to make sure it's valid */ bmcnt = flashrom_calc_crc(buffer_out); - if(bmcnt != *((uint16*)(buffer_out + 62))) { + if(bmcnt != *((uint16*)(buffer_out + FLASHROM_OFFSET_CRC))) { dbglog(DBG_WARNING, "flashrom_get_block: part %d phys block %d has invalid checksum %04x (should be %04x)\n", - partid, i + 1, *((uint16*)(buffer_out + 62)), bmcnt); + partid, i + 1, *((uint16*)(buffer_out + FLASHROM_OFFSET_CRC)), bmcnt); continue; } /* Ok, looks like we got it! */ - rv = 0; - goto ex; + return FLASHROM_ERR_NONE; } /* Didn't find anything */ - rv = -1; - -ex: - free(bitmap); - return rv; + return FLASHROM_ERR_NOT_FOUND; } /* This internal function returns the system config block. As far as I @@ -238,7 +234,7 @@ int flashrom_get_region() { char region[6] = { 0 }; /* Find the partition */ - if(flashrom_info(FLASHROM_PT_SYSTEM, &start, &size) < 0) { + if(flashrom_info(FLASHROM_PT_SYSTEM, &start, &size)) { dbglog(DBG_ERROR, "flashrom_get_region: can't find partition 0\n"); return -1; } diff --git a/kernel/arch/dreamcast/include/dc/flashrom.h b/kernel/arch/dreamcast/include/dc/flashrom.h index b103e45..f035f54 100644 --- a/kernel/arch/dreamcast/include/dc/flashrom.h +++ b/kernel/arch/dreamcast/include/dc/flashrom.h @@ -66,6 +66,23 @@ __BEGIN_DECLS #define FLASHROM_B1_PPPPASSWD 0xE9 /**< \brief PPP passwd (BLOCK_1) */ /** @} */ +#define FLASHROM_OFFSET_CRC 62 /**< \brief Location of CRC in each block */ + +/** \defgroup fr_errs Error values for the flashrom_get_block() function + @{ +*/ +#define FLASHROM_ERR_NONE 0 /**< \brief Success */ +#define FLASHROM_ERR_NOT_FOUND -1 /**< \brief Block not found */ +#define FLASHROM_ERR_NO_PARTITION -2 /**< \brief Partition not found */ +#define FLASHROM_ERR_READ_PART -3 /**< \brief Error reading partition */ +#define FLASHROM_ERR_BAD_MAGIC -4 /**< \brief Invalid block magic */ +#define FLASHROM_ERR_BOGUS_PART -5 /**< \brief Bogus partition size */ +#define FLASHROM_ERR_NOMEM -6 /**< \brief Memory allocation failure */ +#define FLASHROM_ERR_READ_BITMAP -7 /**< \brief Error reading bitmap */ +#define FLASHROM_ERR_EMPTY_PART -8 /**< \brief Empty partition */ +#define FLASHROM_ERR_READ_BLOCK -9 /**< \brief Error reading block */ +/** @} */ + /** \brief Retrieve information about the given partition. This function implements the FLASHROM_INFO syscall; given a partition ID, hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2015-05-21 03:12:32
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via b1d4d7d62b04ab1507a962cf372e171e04a26f6d (commit) from 51634bdb6cfecfe02ddd778edef2cdbc3f8f7e7e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b1d4d7d62b04ab1507a962cf372e171e04a26f6d Author: Lawrence Sebald <ljs...@us...> Date: Wed May 20 23:12:07 2015 -0400 Fix network/isp-settings example. ----------------------------------------------------------------------- Summary of changes: examples/dreamcast/network/isp-settings/Makefile | 4 +-- .../dreamcast/network/isp-settings/isp-settings.c | 35 +++++++++----------- 2 files changed, 17 insertions(+), 22 deletions(-) diff --git a/examples/dreamcast/network/isp-settings/Makefile b/examples/dreamcast/network/isp-settings/Makefile index 5aedd1b..445700e 100644 --- a/examples/dreamcast/network/isp-settings/Makefile +++ b/examples/dreamcast/network/isp-settings/Makefile @@ -12,8 +12,7 @@ rm-elf: -rm -f $(TARGET) $(TARGET): $(OBJS) - $(KOS_CC) $(KOS_CFLAGS) $(KOS_LDFLAGS) -o $(TARGET) $(KOS_START) \ - $(OBJS) $(OBJEXTRA) $(KOS_LIBS) + kos-cc -o $(TARGET) $(OBJS) $(OBJEXTRA) run: $(TARGET) $(KOS_LOADER) $(TARGET) @@ -21,4 +20,3 @@ run: $(TARGET) dist: rm -f $(OBJS) $(KOS_STRIP) $(TARGET) - diff --git a/examples/dreamcast/network/isp-settings/isp-settings.c b/examples/dreamcast/network/isp-settings/isp-settings.c index cd5845d..c4e6dee 100644 --- a/examples/dreamcast/network/isp-settings/isp-settings.c +++ b/examples/dreamcast/network/isp-settings/isp-settings.c @@ -1,10 +1,12 @@ /* KallistiOS ##version## isp-settings.c - Copyright (C)2004 Dan Potter + Copyright (C) 2004 Dan Potter + Copyright (C) 2015 Lawrence Sebald */ -#include <kos.h> +#include <stdio.h> +#include <dc/flashrom.h> /* This uses the new flashrom ISP settings code, which is based heavily on the info from Sam Steele. Thanks Sam! */ @@ -17,7 +19,7 @@ int main(int argc, char **argv) { printf("Couldn't find any IP-related config info!\n"); } else { - if(cfg.ip_valid) { + if((cfg.valid_fields & FLASHROM_ISP_IP)) { static const char * methods[] = { "DHCP", "Static", @@ -34,38 +36,33 @@ int main(int argc, char **argv) { printf("Hostname: '%s'\n", cfg.hostname); } - if(cfg.email_valid) { + if((cfg.valid_fields & FLASHROM_ISP_EMAIL)) printf("Email: '%s'\n", cfg.email); - } - if(cfg.smtp_valid) { + if((cfg.valid_fields & FLASHROM_ISP_SMTP)) printf("SMTP: '%s'\n", cfg.smtp); - } - if(cfg.pop3_valid) { + if((cfg.valid_fields & FLASHROM_ISP_POP3)) printf("POP3: '%s'\n", cfg.pop3); - } - if(cfg.pop3_login_valid) { + if((cfg.valid_fields & FLASHROM_ISP_POP3_USER)) printf("POP3 Login: '%s'\n", cfg.pop3_login); - } - if(cfg.pop3_passwd_valid) { + if((cfg.valid_fields & FLASHROM_ISP_POP3_PASS)) printf("POP3 Pass: '%s'\n", cfg.pop3_passwd); + + if((cfg.valid_fields & FLASHROM_ISP_PROXY_HOST)) printf("Proxy Host: '%s'\n", cfg.proxy_host); - } - if(cfg.ppp_login_valid) { + if((cfg.valid_fields & FLASHROM_ISP_PROXY_PORT)) printf("Proxy Port: %d\n", cfg.proxy_port); + + if((cfg.valid_fields & FLASHROM_ISP_PPP_USER)) printf("PPP Login: '%s'\n", cfg.ppp_login); - } - if(cfg.ppp_passwd_valid) { + if((cfg.valid_fields & FLASHROM_ISP_PPP_PASS)) printf("PPP Pass: '%s'\n", cfg.ppp_passwd); - } } return 0; } - - hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2015-05-19 17:14:03
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 51634bdb6cfecfe02ddd778edef2cdbc3f8f7e7e (commit) via 906093318e8550791d6165f348022a390dd459ff (commit) from 04ccf5f4e299477d57dfc860da8b22bdcf847b15 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 51634bdb6cfecfe02ddd778edef2cdbc3f8f7e7e Author: Lawrence Sebald <ljs...@us...> Date: Tue May 19 13:13:30 2015 -0400 Add some missing headers to <kos.h>. commit 906093318e8550791d6165f348022a390dd459ff Author: Lawrence Sebald <ljs...@us...> Date: Tue May 19 13:10:06 2015 -0400 Add missing __END_DECLS to <dc/g1ata.h>. Without that, any C++ code that tried to include that header would probably break... Oops. ----------------------------------------------------------------------- Summary of changes: include/kos.h | 43 ++++++++++++++++++++--------- kernel/arch/dreamcast/include/dc/g1ata.h | 2 + 2 files changed, 31 insertions(+), 14 deletions(-) diff --git a/include/kos.h b/include/kos.h index cacc85a..4129df3 100644 --- a/include/kos.h +++ b/include/kos.h @@ -1,7 +1,7 @@ /* KallistiOS ##version## kos.h - (c)2001 Dan Potter + Copyright (C) 2001 Dan Potter */ @@ -50,6 +50,11 @@ __BEGIN_DECLS #include <kos/nmmgr.h> #include <kos/exports.h> #include <kos/dbgio.h> +#include <kos/blockdev.h> +#include <kos/dbglog.h> +#include <kos/elf.h> +#include <kos/fs_socket.h> +#include <kos/string.h> #include <arch/arch.h> #include <arch/cache.h> @@ -61,38 +66,48 @@ __BEGIN_DECLS #include <arch/stack.h> #ifdef _arch_dreamcast +# include <arch/gdb.h> # include <arch/mmu.h> +# include <arch/rtc.h> +# include <dc/asic.h> # include <dc/biosfont.h> # include <dc/cdrom.h> +# include <dc/fb_console.h> +# include <dc/flashrom.h> +# include <dc/fmath.h> # include <dc/fs_dcload.h> +# include <dc/fs_dclsocket.h> # include <dc/fs_iso9660.h> # include <dc/fs_vmu.h> -# include <dc/asic.h> +# include <dc/g1ata.h> +# include <dc/g2bus.h> # include <dc/maple.h> # include <dc/maple/controller.h> +# include <dc/maple/dreameye.h> # include <dc/maple/keyboard.h> # include <dc/maple/mouse.h> -# include <dc/maple/vmu.h> -# include <dc/maple/sip.h> # include <dc/maple/purupuru.h> -# include <dc/vmu_pkg.h> -# include <dc/spu.h> -# include <dc/pvr.h> -# include <dc/video.h> -# include <dc/fmath.h> +# include <dc/maple/sip.h> +# include <dc/maple/vmu.h> +# include <dc/matrix3d.h> # include <dc/matrix.h> -# include <dc/sound/stream.h> -# include <dc/sound/sfxmgr.h> +# include <dc/modem/modem.h> # include <dc/net/broadband_adapter.h> # include <dc/net/lan_adapter.h> -# include <dc/modem/modem.h> +# include <dc/pvr.h> +# include <dc/scif.h> +# include <dc/sd.h> +# include <dc/sound/stream.h> +# include <dc/sound/sfxmgr.h> +# include <dc/spu.h> # include <dc/sq.h> # include <dc/ubc.h> -# include <dc/flashrom.h> # include <dc/vblank.h> +# include <dc/vec3f.h> +# include <dc/video.h> +# include <dc/vmu_pkg.h> # include <dc/vmufs.h> -# include <dc/scif.h> #else /* _arch_dreamcast */ # error Invalid architecture or no architecture specified #endif diff --git a/kernel/arch/dreamcast/include/dc/g1ata.h b/kernel/arch/dreamcast/include/dc/g1ata.h index 43de376..36776cd 100644 --- a/kernel/arch/dreamcast/include/dc/g1ata.h +++ b/kernel/arch/dreamcast/include/dc/g1ata.h @@ -395,4 +395,6 @@ int g1_ata_init(void); */ void g1_ata_shutdown(void); +__END_DECLS + #endif /* __DC_G1ATA_H */ hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2015-05-19 16:51:31
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 04ccf5f4e299477d57dfc860da8b22bdcf847b15 (commit) from f0594778c92a8be0bf1c38c1a4c6cd3b6ebbe366 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 04ccf5f4e299477d57dfc860da8b22bdcf847b15 Author: Lawrence Sebald <ljs...@us...> Date: Tue May 19 12:50:17 2015 -0400 Remove fs_dclnative. This hasn't been used in a long while and probably wouldn't work properly anymore anyway. Thus, it's being removed from the tree. No need to keep dead code around, after all. ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/fs/Makefile | 4 - kernel/arch/dreamcast/fs/dcload-commands.c | 160 ------- kernel/arch/dreamcast/fs/dcload-commands.h | 60 --- kernel/arch/dreamcast/fs/dcload-net.c | 231 ---------- kernel/arch/dreamcast/fs/dcload-net.h | 31 -- kernel/arch/dreamcast/fs/dcload-packet.c | 80 ---- kernel/arch/dreamcast/fs/dcload-packet.h | 95 ---- kernel/arch/dreamcast/fs/dcload-syscalls.c | 258 ----------- kernel/arch/dreamcast/fs/dcload-syscalls.h | 103 ----- kernel/arch/dreamcast/fs/fs_dclnative.c | 520 ----------------------- kernel/arch/dreamcast/include/dc/fs_dclnative.h | 60 --- 11 files changed, 0 insertions(+), 1602 deletions(-) delete mode 100644 kernel/arch/dreamcast/fs/dcload-commands.c delete mode 100644 kernel/arch/dreamcast/fs/dcload-commands.h delete mode 100644 kernel/arch/dreamcast/fs/dcload-net.c delete mode 100644 kernel/arch/dreamcast/fs/dcload-net.h delete mode 100644 kernel/arch/dreamcast/fs/dcload-packet.c delete mode 100644 kernel/arch/dreamcast/fs/dcload-packet.h delete mode 100644 kernel/arch/dreamcast/fs/dcload-syscalls.c delete mode 100644 kernel/arch/dreamcast/fs/dcload-syscalls.h delete mode 100644 kernel/arch/dreamcast/fs/fs_dclnative.c delete mode 100644 kernel/arch/dreamcast/include/dc/fs_dclnative.h diff --git a/kernel/arch/dreamcast/fs/Makefile b/kernel/arch/dreamcast/fs/Makefile index 9a4998c..03a2c5d 100644 --- a/kernel/arch/dreamcast/fs/Makefile +++ b/kernel/arch/dreamcast/fs/Makefile @@ -8,10 +8,6 @@ OBJS = fs_iso9660.o fs_vmu.o fs_dcload.o dcload-syscall.o vmufs.o \ fs_dclsocket.o -# OBJS += fs_dclnative.o dcload-commands.o dcload-net.o dcload-packet.o dcload-syscalls.o SUBDIRS = include $(KOS_BASE)/Makefile.prefab - - - diff --git a/kernel/arch/dreamcast/fs/dcload-commands.c b/kernel/arch/dreamcast/fs/dcload-commands.c deleted file mode 100644 index e42d121..0000000 --- a/kernel/arch/dreamcast/fs/dcload-commands.c +++ /dev/null @@ -1,160 +0,0 @@ -/* KallistiOS ##version## - - kernel/arch/dreamcast/fs/dcload-commands.c - - Copyright (C)2001 Andrew Kieschnick, imported - from the GPL'd dc-load-ip sources to a BSD-compatible - license with permission. - - Adapted to KOS by Dan Potter. - -*/ - -#include <dc/fs_dclnative.h> -#include "dcload-commands.h" -#include "dcload-packet.h" -#include "dcload-net.h" -#include "dcload-syscalls.h" - -/* #include "commands.h" -#include "packet.h" -#include "net.h" -#include "video.h" -#include "rtl8139.h" -#include "syscalls.h" -#include "cdfs.h" -#include "dcload.h" -#include "go.h" -#include "disable.h" -#include "scif.h" */ - -#define NAME "dcload-ip-native 1.0.3" - -typedef struct { - unsigned int load_address; - unsigned int load_size; - unsigned char map[16384]; -} bin_info_t; - -static bin_info_t bin_info; - -static unsigned char buffer[COMMAND_LEN + 1024]; /* buffer for response */ -static command_t * response = (command_t *)buffer; - -/* void cmd_reboot(ether_header_t * ether, ip_header_t * ip, udp_header_t * udp, command_t * command) -{ - booted = 0; - running = 0; - - disable_cache(); - go(0x8c004000); -} */ - -void dcln_cmd_loadbin(ip_header_t * ip, udp_header_t * udp, command_t * command) { - bin_info.load_address = ntohl(command->address); - bin_info.load_size = ntohl(command->size); - memset(bin_info.map, 0, 16384); - - dcln_our_ip = ntohl(ip->dest); - - dcln_make_ip(ntohl(ip->src), ntohl(ip->dest), UDP_H_LEN + COMMAND_LEN, 17, (ip_header_t *)(dcln_pkt_buf + ETHER_H_LEN)); - dcln_make_udp(ntohs(udp->src), ntohs(udp->dest), (unsigned char *) command, COMMAND_LEN, (ip_header_t *)(dcln_pkt_buf + ETHER_H_LEN), (udp_header_t *)(dcln_pkt_buf + ETHER_H_LEN + IP_H_LEN)); - dcln_tx(dcln_pkt_buf, ETHER_H_LEN + IP_H_LEN + UDP_H_LEN + COMMAND_LEN); -} - -void dcln_cmd_partbin(ip_header_t * ip, udp_header_t * udp, command_t * command) { - int index = 0; - - memcpy((unsigned char *)ntohl(command->address), command->data, ntohl(command->size)); - - index = (ntohl(command->address) - bin_info.load_address) >> 10; - bin_info.map[index] = 1; -} - -void dcln_cmd_donebin(ip_header_t * ip, udp_header_t * udp, command_t * command) { - int i; - - for(i = 0; i < (bin_info.load_size + 1023) / 1024; i++) - if(!bin_info.map[i]) - break; - - if(i == (bin_info.load_size + 1023) / 1024) { - command->address = htonl(0); - command->size = htonl(0); - } - else { - command->address = htonl(bin_info.load_address + i * 1024); - - if(i == (bin_info.load_size + 1023) / 1024 - 1) - command->size = htonl(bin_info.load_size % 1024); - else - command->size = htonl(1024); - } - - dcln_make_ip(ntohl(ip->src), ntohl(ip->dest), UDP_H_LEN + COMMAND_LEN, 17, (ip_header_t *)(dcln_pkt_buf + ETHER_H_LEN)); - dcln_make_udp(ntohs(udp->src), ntohs(udp->dest), (unsigned char *) command, COMMAND_LEN, (ip_header_t *)(dcln_pkt_buf + ETHER_H_LEN), (udp_header_t *)(dcln_pkt_buf + ETHER_H_LEN + IP_H_LEN)); - dcln_tx(dcln_pkt_buf, ETHER_H_LEN + IP_H_LEN + UDP_H_LEN + COMMAND_LEN); -} - -void dcln_cmd_sendbinq(ip_header_t * ip, udp_header_t * udp, command_t * command) { - int numpackets, i; - unsigned char *ptr; - unsigned int bytes_left; - unsigned int bytes_thistime; - - bytes_left = ntohl(command->size); - numpackets = (ntohl(command->size) + 1023) / 1024; - ptr = (unsigned char *)ntohl(command->address); - - memcpy(response->id, DCLN_CMD_SENDBIN, 4); - - for(i = 0; i < numpackets; i++) { - if(bytes_left >= 1024) - bytes_thistime = 1024; - else - bytes_thistime = bytes_left; - - bytes_left -= bytes_thistime; - - response->address = htonl((unsigned int)ptr); - memcpy(response->data, ptr, bytes_thistime); - response->size = htonl(bytes_thistime); - dcln_make_ip(ntohl(ip->src), ntohl(ip->dest), UDP_H_LEN + COMMAND_LEN + bytes_thistime, 17, (ip_header_t *)(dcln_pkt_buf + ETHER_H_LEN)); - dcln_make_udp(ntohs(udp->src), ntohs(udp->dest), (unsigned char *) response, COMMAND_LEN + bytes_thistime, (ip_header_t *)(dcln_pkt_buf + ETHER_H_LEN), (udp_header_t *)(dcln_pkt_buf + ETHER_H_LEN + IP_H_LEN)); - dcln_tx(dcln_pkt_buf, ETHER_H_LEN + IP_H_LEN + UDP_H_LEN + COMMAND_LEN + bytes_thistime); - ptr += bytes_thistime; - } - - memcpy(response->id, DCLN_CMD_DONEBIN, 4); - response->address = htonl(0); - response->size = htonl(0); - dcln_make_ip(ntohl(ip->src), ntohl(ip->dest), UDP_H_LEN + COMMAND_LEN, 17, (ip_header_t *)(dcln_pkt_buf + ETHER_H_LEN)); - dcln_make_udp(ntohs(udp->src), ntohs(udp->dest), (unsigned char *) response, COMMAND_LEN, (ip_header_t *)(dcln_pkt_buf + ETHER_H_LEN), (udp_header_t *)(dcln_pkt_buf + ETHER_H_LEN + IP_H_LEN)); - dcln_tx(dcln_pkt_buf, ETHER_H_LEN + IP_H_LEN + UDP_H_LEN + COMMAND_LEN); -} - -void dcln_cmd_sendbin(ip_header_t * ip, udp_header_t * udp, command_t * command) { - dcln_our_ip = ntohl(ip->dest); - dcln_cmd_sendbinq(ip, udp, command); -} - -void dcln_cmd_version(ip_header_t * ip, udp_header_t * udp, command_t * command) { - int i; - - i = strlen(NAME) + 1; - memcpy(response, command, COMMAND_LEN); - strcpy(response->data, NAME); - dcln_make_ip(ntohl(ip->src), ntohl(ip->dest), UDP_H_LEN + COMMAND_LEN + i, 17, (ip_header_t *)(dcln_pkt_buf + ETHER_H_LEN)); - dcln_make_udp(ntohs(udp->src), ntohs(udp->dest), (unsigned char *) response, COMMAND_LEN + i, (ip_header_t *)(dcln_pkt_buf + ETHER_H_LEN), (udp_header_t *)(dcln_pkt_buf + ETHER_H_LEN + IP_H_LEN)); - dcln_tx(dcln_pkt_buf, ETHER_H_LEN + IP_H_LEN + UDP_H_LEN + COMMAND_LEN + i); -} - -void dcln_cmd_retval(ip_header_t * ip, udp_header_t * udp, command_t * command) { - dcln_make_ip(ntohl(ip->src), ntohl(ip->dest), UDP_H_LEN + COMMAND_LEN, 17, (ip_header_t *)(dcln_pkt_buf + ETHER_H_LEN)); - dcln_make_udp(ntohs(udp->src), ntohs(udp->dest), (unsigned char *) command, COMMAND_LEN, (ip_header_t *)(dcln_pkt_buf + ETHER_H_LEN), (udp_header_t *)(dcln_pkt_buf + ETHER_H_LEN + IP_H_LEN)); - dcln_tx(dcln_pkt_buf, ETHER_H_LEN + IP_H_LEN + UDP_H_LEN + COMMAND_LEN); - - dcln_syscall_retval = ntohl(command->address); - dcln_syscall_data = command->data; - dcln_escape_loop = 1; -} diff --git a/kernel/arch/dreamcast/fs/dcload-commands.h b/kernel/arch/dreamcast/fs/dcload-commands.h deleted file mode 100644 index 4370df7..0000000 --- a/kernel/arch/dreamcast/fs/dcload-commands.h +++ /dev/null @@ -1,60 +0,0 @@ -/* KallistiOS ##version## - - kernel/arch/dreamcast/fs/dcload-commands.h - - Copyright (C)2003 Andrew Kieschnick, imported - from the GPL'd dc-load-ip sources to a BSD-compatible - license with permission. - - Adapted to KOS by Dan Potter. - -*/ - -#ifndef __COMMANDS_H__ -#define __COMMANDS_H__ - -#include <sys/cdefs.h> -__BEGIN_DECLS - -#include <arch/types.h> - -#include "dcload-packet.h" - -typedef struct { - unsigned char id[4] __attribute__((packed)); - unsigned int address __attribute__((packed)); - unsigned int size __attribute__((packed)); - unsigned char data[1] __attribute__((packed)); -} command_t; - -#define DCLN_CMD_EXECUTE "EXEC" /* execute */ -#define DCLN_CMD_LOADBIN "LBIN" /* begin receiving binary */ -#define DCLN_CMD_PARTBIN "PBIN" /* part of a binary */ -#define DCLN_CMD_DONEBIN "DBIN" /* end receiving binary */ -#define DCLN_CMD_SENDBIN "SBIN" /* send a binary */ -#define DCLN_CMD_SENDBINQ "SBIQ" /* send a binary, quiet */ -#define DCLN_CMD_VERSION "VERS" /* send version info */ - -#define DCLN_CMD_RETVAL "RETV" /* return value */ - -#define DCLN_CMD_REBOOT "RBOT" /* reboot */ - -#define COMMAND_LEN 12 - -extern uint32 dcln_tool_ip; -extern uint8 dcln_tool_mac[6]; -extern uint16 dcln_tool_port; -extern int dcln_escape_loop; - -void dcln_cmd_loadbin(ip_header_t * ip, udp_header_t * udp, command_t * command); -void dcln_cmd_partbin(ip_header_t * ip, udp_header_t * udp, command_t * command); -void dcln_cmd_donebin(ip_header_t * ip, udp_header_t * udp, command_t * command); -void dcln_cmd_sendbinq(ip_header_t * ip, udp_header_t * udp, command_t * command); -void dcln_cmd_sendbin(ip_header_t * ip, udp_header_t * udp, command_t * command); -void dcln_cmd_version(ip_header_t * ip, udp_header_t * udp, command_t * command); -void dcln_cmd_retval(ip_header_t * ip, udp_header_t * udp, command_t * command); - -__END_DECLS - -#endif - diff --git a/kernel/arch/dreamcast/fs/dcload-net.c b/kernel/arch/dreamcast/fs/dcload-net.c deleted file mode 100644 index 2635f46..0000000 --- a/kernel/arch/dreamcast/fs/dcload-net.c +++ /dev/null @@ -1,231 +0,0 @@ -/* KallistiOS ##version## - - kernel/arch/dreamcast/fs/dcload-net.c - - Copyright (C)2001 Andrew Kieschnick, imported - from the GPL'd dc-load-ip sources to a BSD-compatible - license with permission. - - Adapted to KOS by Dan Potter. - -*/ - -#include <dc/fs_dclnative.h> -#include "dcload-commands.h" -#include "dcload-packet.h" -#include "dcload-net.h" - -static unsigned char broadcast[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; - -static void process_broadcast(unsigned char *pkt, int len) { - ether_header_t *ether_header = (ether_header_t *)pkt; - arp_header_t *arp_header = (arp_header_t *)(pkt + ETHER_H_LEN); - unsigned char tmp[10]; - unsigned int ip = htonl(dcln_our_ip); - - if(ether_header->type[1] != 0x06) /* ARP */ - return; - - /* hardware address space = ethernet */ - if(arp_header->hw_addr_space != 0x0100) - return; - - /* protocol address space = IP */ - if(arp_header->proto_addr_space != 0x0008) - return; - - if(arp_header->opcode == 0x0100) { /* arp request */ - if(dcln_our_ip == 0) /* return if we don't know our ip */ - return; - - if(!memcmp(arp_header->proto_target, &ip, 4)) { /* for us */ - /* put src hw address into dest hw address */ - memcpy(ether_header->dest, ether_header->src, 6); - /* put our hw address into src hw address */ - memcpy(ether_header->src, dcln_our_mac, 6); - arp_header->opcode = 0x0200; /* arp reply */ - /* swap sender and target addresses */ - memcpy(tmp, arp_header->hw_sender, 10); - memcpy(arp_header->hw_sender, arp_header->hw_target, 10); - memcpy(arp_header->hw_target, tmp, 10); - /* put our hw address into sender hw address */ - memcpy(arp_header->hw_sender, dcln_our_mac, 6); - /* transmit */ - dcln_tx(pkt, ETHER_H_LEN + ARP_H_LEN); - } - } -} - -static void process_icmp(ether_header_t *ether, ip_header_t *ip, icmp_header_t *icmp) { - unsigned int i; - unsigned char tmp[6]; - - memset(dcln_pkt_buf, 0, ntohs(ip->length) + (ntohs(ip->length) % 2) - 4 * (ip->version_ihl & 0x0f)); - - /* check icmp checksum */ - i = icmp->checksum; - icmp->checksum = 0; - memcpy(dcln_pkt_buf, icmp, ntohs(ip->length) - 4 * (ip->version_ihl & 0x0f)); - icmp->checksum = dcln_checksum((unsigned short *)dcln_pkt_buf, (ntohs(ip->length) + 1) / 2 - 2 * (ip->version_ihl & 0x0f)); - - if(i != icmp->checksum) - return; - - if(icmp->type == 8) { /* echo request */ - icmp->type = 0; /* echo reply */ - /* swap src and dest hw addresses */ - memcpy(tmp, ether->dest, 6); - memcpy(ether->dest, ether->src, 6); - memcpy(ether->src, tmp, 6); - /* swap src and dest ip addresses */ - memcpy(&i, &ip->src, 4); - memcpy(&ip->src, &ip->dest, 4); - memcpy(&ip->dest, &i, 4); - /* recompute ip header checksum */ - ip->checksum = 0; - ip->checksum = dcln_checksum((unsigned short *)ip, 2 * (ip->version_ihl & 0x0f)); - /* recompute icmp checksum */ - icmp->checksum = 0; - icmp->checksum = dcln_checksum((unsigned short *)icmp, ntohs(ip->length) / 2 - 2 * (ip->version_ihl & 0x0f)); - /* transmit */ - dcln_tx((uint8 *)ether, ETHER_H_LEN + ntohs(ip->length)); - } -} - -/* typedef struct { - unsigned int load_address; - unsigned int load_size; - unsigned char map[16384]; -} bin_info_t; - -static bin_info_t bin_info; */ - -static void process_udp(ether_header_t *ether, ip_header_t *ip, udp_header_t *udp) { - ip_udp_pseudo_header_t *pseudo; - unsigned short i; - command_t *command; - - pseudo = (ip_udp_pseudo_header_t *)dcln_pkt_buf; - pseudo->src_ip = ip->src; - pseudo->dest_ip = ip->dest; - pseudo->zero = 0; - pseudo->protocol = ip->protocol; - pseudo->udp_length = udp->length; - pseudo->src_port = udp->src; - pseudo->dest_port = udp->dest; - pseudo->length = udp->length; - pseudo->checksum = 0; - memset(pseudo->data, 0, ntohs(udp->length) - 8 + (ntohs(udp->length) % 2)); - memcpy(pseudo->data, udp->data, ntohs(udp->length) - 8); - - /* checksum == 0 means no checksum */ - if(udp->checksum != 0) - i = dcln_checksum((unsigned short *)pseudo, (sizeof(ip_udp_pseudo_header_t) + ntohs(udp->length) - 9 + 1) / 2); - else - i = 0; - - /* checksum == 0xffff means checksum was really 0 */ - if(udp->checksum == 0xffff) - udp->checksum = 0; - - if(i != udp->checksum) { - /* scif_puts("UDP CHECKSUM BAD\n"); */ - return; - } - - dcln_make_ether(ether->src, ether->dest, (ether_header_t *)dcln_pkt_buf); - - command = (command_t *)udp->data; - - /* Some of these aren't applicable at this point. */ - /* if (!memcmp(command->id, DCLN_CMD_EXECUTE, 4)) { - dcln_cmd_execute(ether, ip, udp, command); - } */ - - if(!memcmp(command->id, DCLN_CMD_LOADBIN, 4)) { - dcln_cmd_loadbin(ip, udp, command); - } - - if(!memcmp(command->id, DCLN_CMD_PARTBIN, 4)) { - dcln_cmd_partbin(ip, udp, command); - } - - if(!memcmp(command->id, DCLN_CMD_DONEBIN, 4)) { - dcln_cmd_donebin(ip, udp, command); - } - - if(!memcmp(command->id, DCLN_CMD_SENDBINQ, 4)) { - dcln_cmd_sendbinq(ip, udp, command); - } - - if(!memcmp(command->id, DCLN_CMD_SENDBIN, 4)) { - dcln_cmd_sendbin(ip, udp, command); - } - - if(!memcmp(command->id, DCLN_CMD_VERSION, 4)) { - dcln_cmd_version(ip, udp, command); - } - - if(!memcmp(command->id, DCLN_CMD_RETVAL, 4)) { - dcln_cmd_retval(ip, udp, command); - } - - /* if (!memcmp(command->id, DCLN_CMD_REBOOT, 4)) { - dcln_cmd_reboot(ip, udp, command); - } */ -} - -static void process_mine(unsigned char *pkt, int len) { - ether_header_t *ether_header = (ether_header_t *)pkt; - ip_header_t *ip_header = (ip_header_t *)(pkt + 14); - icmp_header_t *icmp_header; - udp_header_t *udp_header; - /* ip_udp_pseudo_header_t *ip_udp_pseudo_header; - unsigned char tmp[6]; */ - int i; - - if(ether_header->type[1] != 0x00) - return; - - /* ignore fragmented packets */ - - if(ntohs(ip_header->flags_frag_offset) & 0x3fff) - return; - - /* check ip header checksum */ - i = ip_header->checksum; - ip_header->checksum = 0; - ip_header->checksum = dcln_checksum((unsigned short *)ip_header, 2 * (ip_header->version_ihl & 0x0f)); - - if(i != ip_header->checksum) - return; - - switch(ip_header->protocol) { - case 1: /* icmp */ - icmp_header = (icmp_header_t *)(pkt + ETHER_H_LEN + 4 * (ip_header->version_ihl & 0x0f)); - process_icmp(ether_header, ip_header, icmp_header); - break; - case 17: /* udp */ - udp_header = (udp_header_t *)(pkt + ETHER_H_LEN + 4 * (ip_header->version_ihl & 0x0f)); - process_udp(ether_header, ip_header, udp_header); - default: - break; - } -} - -void dcln_process_pkt(unsigned char *pkt, int len) { - ether_header_t *ether_header = (ether_header_t *)pkt; - - if(ether_header->type[0] != 0x08) - return; - - if(!memcmp(ether_header->dest, broadcast, 6)) { - process_broadcast(pkt, len); - return; - } - - if(!memcmp(ether_header->dest, dcln_our_mac, 6)) { - process_mine(pkt, len); - return; - } -} diff --git a/kernel/arch/dreamcast/fs/dcload-net.h b/kernel/arch/dreamcast/fs/dcload-net.h deleted file mode 100644 index e7b6f4e..0000000 --- a/kernel/arch/dreamcast/fs/dcload-net.h +++ /dev/null ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2015-05-19 16:02:14
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via f0594778c92a8be0bf1c38c1a4c6cd3b6ebbe366 (commit) via 348032abfd44a2f2165d81adc60e38b666e948c2 (commit) from cd09ed8abf794a43599c0a415c2de6b2b702f9d1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f0594778c92a8be0bf1c38c1a4c6cd3b6ebbe366 Author: Lawrence Sebald <ljs...@us...> Date: Tue May 19 12:01:44 2015 -0400 Update the FAQs a bit. commit 348032abfd44a2f2165d81adc60e38b666e948c2 Author: Lawrence Sebald <ljs...@us...> Date: Tue May 19 11:38:18 2015 -0400 Move changelog entry to keep it in (relatively) chronological order. ----------------------------------------------------------------------- Summary of changes: doc/CHANGELOG | 2 +- doc/FAQ | 114 +++++++++++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 103 insertions(+), 13 deletions(-) diff --git a/doc/CHANGELOG b/doc/CHANGELOG index 31028b3..fea4583 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -5,7 +5,6 @@ versions (where they are missing from early versions, assume that they should be attributed to Dan Potter). KallistiOS version 2.0.1 ----------------------------------------------- -- DC Add support for German (DE) and UK keyboards [Christian Groessler == CG] - *** Cleaned up generated stubs files on a make clean [Lawrence Sebald = LS] - DC Added a function to detect if the program is being run on a retail Dreamcast or a Set5.xx device [LS] @@ -67,6 +66,7 @@ KallistiOS version 2.0.1 ----------------------------------------------- unlock a mutex as if it were a specified thread [LS] - DC Fixed a deadlock issue in the G1ATA code related to the use of a recursive mutex for locking -- Thanks to SWAT for noticing the issue [LS] +- DC Add support for German (DE) and UK keyboards [Christian Groessler == CG] KallistiOS version 2.0.0 ----------------------------------------------- - DC Broadband Adapter driver fixes [Dan Potter == DP] diff --git a/doc/FAQ b/doc/FAQ index 6cf0bef..d296889 100644 --- a/doc/FAQ +++ b/doc/FAQ @@ -1,6 +1,6 @@ KallistiOS ##version## FAQ Copyright (C) 2001 Dan Potter -Copyright (C) 2012-2014 Lawrence Sebald +Copyright (C) 2012-2015 Lawrence Sebald Here you may find some answers to some common questions we hear regarding the usage of KOS. We will be adding more to this file over @@ -90,8 +90,8 @@ are the breaks. Sorry. Also, to keep you safe from accidentally linking GPL'd code into your program, 100% of this code is located inside the "xingmp3" tree in the -"addons" tree. All headers in the global "headers" tree are either ours -or otherwise BSD-style licensed. +"libmp3" tree. All headers in the "include" directory for libmp3 are +either ours, or similarly available under a BSD-like license. 1 --- OS Basics -------------------------------------------------------- @@ -326,19 +326,18 @@ Q) Does KOS have any kind of TCP/IP stack? Network support at all? A) Yes. There is a working driver for the Sega broadband adapter (an RTL8193C based 10/100 card) and the Lan Adapter on the DC. With regards -to TCP/IP and friends, there are two choices: either you can use the -built-in network stack or you can use lwIP, which is in the kos-ports -tree. Note that lwIP is pretty much considered deprecated now, and -isn't actively tested anymore. You should use the internal network stack -for all new code. +to TCP/IP and friends, there is a built-in network stack provided in +the kernel tree. There is also a PPP stack provided in the addons tree +for using the modem. -There is also a driver for the Dreamcast modem and a PPP stack that links -it into the rest of the TCP/IP stack. +lwIP used to be provided as an alternate TCP/IP stack for the BBA and +Lan Adapters, however it was removed from the kos-ports tree as it has +been deprecated by the built-in network stack. 3.2 -Q) What about a BSD stack? +Q) What about the BSD stack? A) That seems to be everyone's generic answer to wanting a TCP/IP stack. Have you actually _looked_ at the BSD stack? Not just glanced through it @@ -381,7 +380,7 @@ previously but those should now be fixed. Q) I work on a DC; I don't have a serial cable so how can I see the debug output? -A) Use dc-load-ip with your broadband adapter or lan adapter on the +A) Use dc-load-ip with your broadband adapter or Lan adapter on the Dreamcast. If you don't have one of those, you might look into fb_console, which you can redirect to either the whole frame buffer or a texture somewhere in VRAM. @@ -414,4 +413,95 @@ for the DC port which lets you place manual breakpoints, but it doesn't support any sort of tracing. +6 --- kos-ports --------------------------------------------------------- + +6.1 + +Q) What is kos-ports? + +A) kos-ports is a repository of libraries that have been ported to or +designed for KallistiOS over the years. Most (but not all) of the ported +libraries contain some KOS-specific functionality, such as interfacing +with the PVR code for texture loading or other things of the sort. + +Note that kos-ports no longer contains the full source code of each +ported library. This has been done to make updating each port easier (and +thus to actually encourage us to do so). Instead, each port in kos-ports +contains a minimal amount of metadata that is used to build the library +in question from the upstream source (where available). In addition, the +kos-ports system keeps track of dependencies and other such things to +ensure that you don't try to do something like building libpng without +having zlib already built. + + +6.2 + +Q) How do I get kos-ports? + +A) If you're using a release version of KOS, I'd recommend grabbing the +corresponding release version of the kos-ports tree from the sourceforge +file release system (or by using a version-specific tag to check it out +from the Git repository). That way, you'll know that each port should +actually work with the version of KOS you're using, in case there have +been updates done to it in the Git repository to support new versions +of KOS. + +If you're tracking the Git repository for KOS, then I'd recommend doing +the same for kos-ports. You can grab the latest Git version of kos-ports +by doing the following in a shell: + + git clone git://git.code.sf.net/p/cadcdev/kos-ports + +I'd recommend putting the kos-ports tree as a sibling of the main KOS +tree (putting the root kos-ports directory in the same parent directory +as your kos tree). + +You can then update the kos-ports tree by doing a "git pull" in the +kos-ports directory (you will have to check each port for updates +yourself). + + +6.3 + +Q) How do I build a port? + +Q) How do I update an installed version of a port? + +Q) How do I build every port that's available, as I used to do? + +To build one port (and any of its dependencies), simply cd to the port's +directory in the kos-ports tree and run the following command: + + make install clean + +This command will also work for updating a port you already have +installed (but it will not update dependencies). + +If you really want to install every port that is in the tree, there is +a script to do so. Simply cd to the kos-ports directory and run the +following command: + + utils/build-all.sh + +I personally don't recommend building every port, but rather building +only those you use, but to each his own, as they say. + + +6.4 + +Q) When I try to build a port, I get an error complaining that "curl" is +not found. What's up with that? + +The curl utility is used by default to download the distribution files +for each port. If you'd rather use wget to do this (or any other similar +utility), edit the kos-ports/config.mk file to point to your favorite +utility. There is an example in there for using wget already -- just +comment out the "FETCH_CMD = curl --progress-bar -O" line by putting a +# in front of it, and uncomment the line below it to use wget instead. + +As for why curl is the default, well, it's installed by default on OS X, +which is what I use for development currently. ;-) Plus, it's easily +available on pretty much every *nix system. + + --- End ------------------------------------------------------------ hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2015-05-19 02:37:04
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via cd09ed8abf794a43599c0a415c2de6b2b702f9d1 (commit) from 2c8435324d52a1bcf4bb7a97e09780d231f89dcc (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit cd09ed8abf794a43599c0a415c2de6b2b702f9d1 Author: Lawrence Sebald <ljs...@us...> Date: Mon May 18 22:36:33 2015 -0400 Update Lua example to work with the new version in kos-ports. ----------------------------------------------------------------------- Summary of changes: examples/dreamcast/lua/basic/Makefile | 8 +- examples/dreamcast/lua/basic/lua.c | 488 ++++++++++++++++++++------------- 2 files changed, 304 insertions(+), 192 deletions(-) diff --git a/examples/dreamcast/lua/basic/Makefile b/examples/dreamcast/lua/basic/Makefile index a0698b3..4b3b4f8 100644 --- a/examples/dreamcast/lua/basic/Makefile +++ b/examples/dreamcast/lua/basic/Makefile @@ -6,8 +6,7 @@ all: rm-elf lua.elf -KOS_LOCAL_CFLAGS := -I$(KOS_BASE)/addons/lua/include - +KOS_CFLAGS += -I$(KOS_PORTS)/include/lua include $(KOS_BASE)/Makefile.rules @@ -19,9 +18,8 @@ clean: rm-elf: -rm -f lua.elf -lua.elf: $(OBJS) - $(KOS_CC) $(KOS_CFLAGS) $(KOS_LDFLAGS) -o lua.elf $(KOS_START) $(OBJS) $(DATAOBJS) \ - $(OBJEXTRA) -llua -llualib -lconio $(KOS_LIBS) -lm +lua.elf: $(OBJS) + kos-cc -o lua.elf $(OBJS) $(DATAOBJS) $(OBJEXTRA) -llua -lm run: lua.elf $(KOS_LOADER) lua.elf diff --git a/examples/dreamcast/lua/basic/lua.c b/examples/dreamcast/lua/basic/lua.c index 6377bb2..11c9ac8 100644 --- a/examples/dreamcast/lua/basic/lua.c +++ b/examples/dreamcast/lua/basic/lua.c @@ -1,252 +1,366 @@ /* +** $Id: lua.c,v 1.222 2014/11/11 19:41:27 roberto Exp $ ** Lua stand-alone interpreter ** See Copyright Notice in lua.h */ -/* Ported to KOS conio by Dan Potter */ +#define lua_c + +#if 0 +#include "lprefix.h" -#include <kos.h> -#include <conio/conio.h> -#include <assert.h> +#include <signal.h> +#endif + #include <stdio.h> #include <stdlib.h> #include <string.h> -/* #include "lua.h" +#include "lua.h" -#include "luadebug.h" -#include "lualib.h" */ -#include <lua/lua.h> +#include "lauxlib.h" +#include "lualib.h" +/* KOS-specific stuff. */ +#include <kos/dbgio.h> +#include <dc/maple.h> +#include <dc/maple/keyboard.h> +#include <dc/maple/controller.h> -static lua_State *L = NULL; +void cont_cb(uint8 addr, uint32 btns) { + (void)addr; + (void)btns; + exit(0); +} -#ifndef PROMPT -#define PROMPT "> " -#endif +static int kbd_readline(char *buf, int len) { + int ch = 0; + maple_device_t *dev; + int pos = 0; + + if(!buf || !len) + return 0; -static void laction(int i); + /* Clear the buffer. */ + memset(buf, 0, len); + while(ch != '\n' && pos < len - 1) { + /* Not really sensible, but just in case someone unplugs and replugs + their keyboard, we'll probably work right... */ + if((dev = maple_enum_type(0, MAPLE_FUNC_KEYBOARD))) { + ch = kbd_queue_pop(dev, 1); -static lua_Hook old_linehook = NULL; -static lua_Hook old_callhook = NULL; + /* Make sure we got an ASCII character. */ + if((ch & 0xFFFFFF00)) + continue; -static void userinit(void) { - lua_baselibopen(L); - lua_iolibopen(L); - lua_strlibopen(L); - lua_mathlibopen(L); - lua_dblibopen(L); - /* add your libraries here */ + /* Put the character into the buffer and print it out on the + terminal. */ + buf[pos++] = (char)ch; + printf("%c", (char)ch); + fflush(stdout); + } + } + + return 1; } -static int ldo(int (*f)(lua_State *l, const char *), const char *name) { - int res; - int top = lua_gettop(L); - res = f(L, name); /* dostring | dofile */ - lua_settop(L, top); /* remove eventual results */ +#define lua_readline(L,b,p) \ + ((void)L, fputs(p, stdout), fflush(stdout), /* show prompt */ \ + kbd_readline(b, LUA_MAXINPUT) != 0) /* get line */ +#define lua_saveline(L,idx) { (void)L; (void)idx; } +#define lua_freeline(L,b) { (void)L; (void)b; } - /* Lua gives no message in such cases, so lua.c provides one */ - if(res == LUA_ERRMEM) { - conio_printf("lua: memory allocation error\n"); - } - else if(res == LUA_ERRERR) - conio_printf("lua: error in error message\n"); +#define lua_stdin_is_tty() 1 /* assume stdin is a tty */ + +/* End KOS-specific stuff. */ + + +#if !defined(LUA_PROMPT) +#define LUA_PROMPT "> " +#define LUA_PROMPT2 ">> " +#endif + +#if !defined(LUA_PROGNAME) +#define LUA_PROGNAME "lua" +#endif + +#if !defined(LUA_MAXINPUT) +#define LUA_MAXINPUT 512 +#endif + +#if !defined(LUA_INIT_VAR) +#define LUA_INIT_VAR "LUA_INIT" +#endif + +#define LUA_INITVARVERSION \ + LUA_INIT_VAR "_" LUA_VERSION_MAJOR "_" LUA_VERSION_MINOR + + +static lua_State *globalL = NULL; + +static const char *progname = LUA_PROGNAME; - return res; +/* +** Prints an error message, adding the program name in front of it +** (if present) +*/ +static void l_message (const char *pname, const char *msg) { + if (pname) lua_writestringerror("%s: ", pname); + lua_writestringerror("%s\n", msg); } -static void print_version(void) { - conio_printf("%.80s %.80s\n", LUA_VERSION, LUA_COPYRIGHT); +/* +** Check whether 'status' is not OK and, if so, prints the error +** message on the top of the stack. It assumes that the error object +** is a string, as it was either generated by Lua or by 'msghandler'. +*/ +static int report (lua_State *L, int status) { + if (status != LUA_OK) { + const char *msg = lua_tostring(L, -1); + l_message(progname, msg); + lua_pop(L, 1); /* remove message */ + } + return status; } -static void assign(char *arg) { - char *eq = strchr(arg, '='); - *eq = '\0'; /* spilt `arg' in two strings (name & value) */ - lua_pushstring(L, eq + 1); - lua_setglobal(L, arg); +/* +** Message handler used to run all chunks +*/ +static int msghandler (lua_State *L) { + const char *msg = lua_tostring(L, 1); + if (msg == NULL) { /* is error object not a string? */ + if (luaL_callmeta(L, 1, "__tostring") && /* does it have a metamethod */ + lua_type(L, -1) == LUA_TSTRING) /* that produces a string? */ + return 1; /* that is the message */ + else + msg = lua_pushfstring(L, "(error object is a %s value)", + luaL_typename(L, 1)); + } + luaL_traceback(L, L, msg, 1); /* append a standard traceback */ + return 1; /* return the traceback */ } -static void getargs(char *argv[]) { - int i; - lua_newtable(L); +/* +** Interface to 'lua_pcall', which sets appropriate message function +** and C-signal handler. Used to run all chunks. +*/ +static int docall (lua_State *L, int narg, int nres) { + int status; + int base = lua_gettop(L) - narg; /* function index */ + lua_pushcfunction(L, msghandler); /* push message handler */ + lua_insert(L, base); /* put it under function and args */ + globalL = L; /* to be available to 'laction' */ - for(i = 0; argv[i]; i++) { - /* arg[i] = argv[i] */ - lua_pushnumber(L, i); - lua_pushstring(L, argv[i]); - lua_settable(L, -3); - } + status = lua_pcall(L, narg, nres, base); - /* arg.n = maximum index in table `arg' */ - lua_pushstring(L, "n"); - lua_pushnumber(L, i - 1); - lua_settable(L, -3); + lua_remove(L, base); /* remove message handler from the stack */ + return status; } -static int l_getargs(lua_State *l) { - char **argv = (char **)lua_touserdata(l, -1); - getargs(argv); - return 1; +static void print_version (void) { + lua_writestring(LUA_COPYRIGHT, strlen(LUA_COPYRIGHT)); + lua_writeline(); } -/* maximum length of an input string */ -#ifndef MAXINPUT -#define MAXINPUT BUFSIZ -#endif +/* +** Returns the string to be used as a prompt by the interpreter. +*/ +static const char *get_prompt (lua_State *L, int firstline) { + const char *p; + lua_getglobal(L, firstline ? "_PROMPT" : "_PROMPT2"); + p = lua_tostring(L, -1); + if (p == NULL) p = (firstline ? LUA_PROMPT : LUA_PROMPT2); + return p; +} -static void manual_input(int version, int prompt) { - int cont = 1, r; +/* mark in error messages for incomplete statements */ +#define EOFMARK "<eof>" +#define marklen (sizeof(EOFMARK)/sizeof(char) - 1) - if(version) print_version(); - while(cont) { - char buffer[MAXINPUT]; - int i = 0; +/* +** Check whether 'status' signals a syntax error and the error +** message at the top of the stack ends with the above mark for +** incomplete statements. +*/ +static int incomplete (lua_State *L, int status) { + if (status == LUA_ERRSYNTAX) { + size_t lmsg; + const char *msg = lua_tolstring(L, -1, &lmsg); + if (lmsg >= marklen && strcmp(msg + lmsg - marklen, EOFMARK) == 0) { + lua_pop(L, 1); + return 1; + } + } + return 0; /* else... */ +} - if(prompt) { - const char *s; - lua_getglobal(L, "_PROMPT"); - s = lua_tostring(L, -1); - if(!s) s = PROMPT; +/* +** Prompt the user, read a line, and push it into the Lua stack. +*/ +static int pushline (lua_State *L, int firstline) { + char buffer[LUA_MAXINPUT]; + char *b = buffer; + size_t l; + const char *prmt = get_prompt(L, firstline); + int readstatus = lua_readline(L, b, prmt); + if (readstatus == 0) + return 0; /* no input (prompt will be popped by caller) */ + lua_pop(L, 1); /* remove prompt */ + l = strlen(b); + if (l > 0 && b[l-1] == '\n') /* line ends with newline? */ + b[l-1] = '\0'; /* remove it */ + if (firstline && b[0] == '=') /* for compatibility with 5.2, ... */ + lua_pushfstring(L, "return %s", b + 1); /* change '=' to 'return' */ + else + lua_pushstring(L, b); + lua_freeline(L, b); + return 1; +} - conio_printf(s); - lua_pop(L, 1); /* remove global */ - } - r = conio_input_getline(-1, buffer, MAXINPUT); - assert(r >= 0); +/* +** Try to compile line on the stack as 'return <line>'; on return, stack +** has either compiled chunk or original line (if compilation failed). +*/ +static int addreturn (lua_State *L) { + int status; + size_t len; const char *line; + lua_pushliteral(L, "return "); + lua_pushvalue(L, -2); /* duplicate line */ + lua_concat(L, 2); /* new line is "return ..." */ + line = lua_tolstring(L, -1, &len); + if ((status = luaL_loadbuffer(L, line, len, "=stdin")) == LUA_OK) + lua_remove(L, -3); /* remove original line */ + else + lua_pop(L, 2); /* remove result from 'luaL_loadbuffer' and new line */ + return status; +} - if(strlen(buffer)) { - ldo(lua_dostring, buffer); - lua_settop(L, 0); /* remove eventual results */ - } - } - conio_printf("\n"); +/* +** Read multiple lines until a complete Lua statement +*/ +static int multiline (lua_State *L) { + for (;;) { /* repeat until gets a complete statement */ + size_t len; + const char *line = lua_tolstring(L, 1, &len); /* get what it has */ + int status = luaL_loadbuffer(L, line, len, "=stdin"); /* try it */ + if (!incomplete(L, status) || !pushline(L, 0)) + return status; /* cannot or should not try to add continuation line */ + lua_pushliteral(L, "\n"); /* add newline... */ + lua_insert(L, -2); /* ...between the two lines */ + lua_concat(L, 3); /* join them */ + } } -#if 0 -static int handle_argv(char *argv[], struct Options *opt) { - if(opt->stacksize > 0) argv++; /* skip option `-s' (if present) */ - - if(*argv == NULL) { /* no more arguments? */ - if(isatty(0)) { - manual_input(1, 1); - } - else - ldo(lua_dofile, NULL); /* executes stdin as a file */ - } - else { /* other arguments; loop over them */ - int i; - - for(i = 0; argv[i] != NULL; i++) { - if(argv[i][0] != '-') { /* not an option? */ - if(strchr(argv[i], '=')) - assign(argv[i]); - else if(file_input(argv[i]) != EXIT_SUCCESS) - return EXIT_FAILURE; /* stop if file fails */ - } - else switch(argv[i][1]) { /* option */ - case 0: { - ldo(lua_dofile, NULL); /* executes stdin as a file */ - break; - } - case 'i': { - manual_input(0, 1); - break; - } - case 'q': { - manual_input(0, 0); - break; - } - case 'c': { - opt->toclose = 1; - break; - } - case 'v': { - print_version(); - break; - } - case 'e': { - i++; - - if(argv[i] == NULL) { - print_message(); - return EXIT_FAILURE; - } - - if(ldo(lua_dostring, argv[i]) != 0) { - fprintf(stderr, "lua: error running argument `%.99s'\n", argv[i]); - return EXIT_FAILURE; - } - - break; - } - case 'f': { - i++; - - if(argv[i] == NULL) { - print_message(); - return EXIT_FAILURE; - } - - getargs(argv + i); /* collect remaining arguments */ - lua_setglobal(L, "arg"); - return file_input(argv[i]); /* stop scanning arguments */ - } - case 's': { - fprintf(stderr, "lua: stack size (`-s') must be the first option\n"); - return EXIT_FAILURE; - } - default: { - print_message(); - return EXIT_FAILURE; - } - } - } - } - return EXIT_SUCCESS; +/* +** Read a line and try to load (compile) it first as an expression (by +** adding "return " in front of it) and second as a statement. Return +** the final status of load/call with the resulting function (if any) +** in the top of the stack. +*/ +static int loadline (lua_State *L) { + int status; + lua_settop(L, 0); + if (!pushline(L, 1)) + return -1; /* no input */ + if ((status = addreturn(L)) != LUA_OK) /* 'return ...' did not work? */ + status = multiline(L); /* try as command, maybe with continuation lines */ + lua_saveline(L, 1); /* keep history */ + lua_remove(L, 1); /* remove line from the stack */ + lua_assert(lua_gettop(L) == 1); + return status; } -#endif -static void register_getargs(char *argv[]) { - lua_pushlightuserdata(L, argv); - lua_pushcclosure(L, l_getargs, 1); - lua_setglobal(L, "getargs"); + +/* +** Prints (calling the Lua 'print' function) any values on the stack +*/ +static void l_print (lua_State *L) { + int n = lua_gettop(L); + if (n > 0) { /* any result to be printed? */ + luaL_checkstack(L, LUA_MINSTACK, "too many results to print"); + lua_getglobal(L, "print"); + lua_insert(L, 1); + if (lua_pcall(L, n, 0, 0) != LUA_OK) + l_message(progname, lua_pushfstring(L, "error calling 'print' (%s)", + lua_tostring(L, -1))); + } } -int main(int argc, char *argv[]) { - int status; +/* +** Do the REPL: repeatedly read (load) a line, evaluate (call) it, and +** print any results. ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2015-05-17 00:11:41
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 2c8435324d52a1bcf4bb7a97e09780d231f89dcc (commit) via fadcec0dbefe4f4b6777ab8d79f80e31963c0f02 (commit) from 44d01d6c47277454d4eb1e139fa04093f5d23082 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 2c8435324d52a1bcf4bb7a97e09780d231f89dcc Author: Lawrence Sebald <ljs...@us...> Date: Sat May 16 19:40:05 2015 -0400 Add a bit about the new kos-ports to the release notes. commit fadcec0dbefe4f4b6777ab8d79f80e31963c0f02 Author: Lawrence Sebald <ljs...@us...> Date: Sat May 16 19:38:05 2015 -0400 Update the vorbis examples to work with new kos-ports. liboggvorbisplay has been split into three libraries in the new kos-ports, so this updates the vorbis examples to allow for that. It's just a simple Makefile change, so nothing major to see here. ----------------------------------------------------------------------- Summary of changes: doc/RELNOTES | 15 ++++++++++++++- .../dreamcast/sound/ghettoplay-vorbis/Makefile | 2 +- examples/dreamcast/sound/hello-ogg/Makefile | 2 +- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/doc/RELNOTES b/doc/RELNOTES index 9e29860..91424e2 100644 --- a/doc/RELNOTES +++ b/doc/RELNOTES @@ -1,6 +1,6 @@ KallistiOS ##version## Copyright (C) 2002, 2003 Dan Potter -Copyright (C) 2012-2014 Lawrence Sebald +Copyright (C) 2012-2015 Lawrence Sebald RELEASE NOTES for 2.0.1 ----------------------- @@ -58,6 +58,19 @@ samples into some buffer in your program and basically return immediately from the callback (it is called in an IRQ handler context, so you really shouldn't be doing a lot of work in the callback). +The kos-ports tree has been changed quite a bit from the last release. No longer +does the kos-ports tree itself host all the source code of the various libraries +it contains, but rather just (generally) a Makefile with some metadata and any +patched or additional files needed for building the library for KOS. You build a +library simply by going into its directory in the kos-ports tree and running +"make install clean", much like the FreeBSD ports collection. Check out the +README in the kos-ports tree for more information. Some libraries have been +updated in the switchover, so keep that in mind. Anything that uses Lua or +liboggvorbisplay will probably have a bit of fixing up needed. Lua has been +updated to 5.3.0. liboggvorbisplay has been split into three libraries: libogg, +libvorbis, and liboggvorbisplay (the first two are the official libraries from +Xiph.org and liboggvorbisplay is the KOS wrapper for them). + RELEASE NOTES for 2.0.0 ----------------------- This release has been a long time coming, to say the least. Pretty much every diff --git a/examples/dreamcast/sound/ghettoplay-vorbis/Makefile b/examples/dreamcast/sound/ghettoplay-vorbis/Makefile index 896558c..86a044b 100644 --- a/examples/dreamcast/sound/ghettoplay-vorbis/Makefile +++ b/examples/dreamcast/sound/ghettoplay-vorbis/Makefile @@ -11,7 +11,7 @@ clean: rm-elf -rm -f $(OBJS) $(TARGET): $(OBJS) - kos-cc -o $(TARGET) $(OBJS) -loggvorbisplay -lm + kos-cc -o $(TARGET) $(OBJS) -loggvorbisplay -lvorbis -logg -lm romdisk.img: $(KOS_GENROMFS) -f romdisk.img -d romdisk -v diff --git a/examples/dreamcast/sound/hello-ogg/Makefile b/examples/dreamcast/sound/hello-ogg/Makefile index 854050b..915b528 100644 --- a/examples/dreamcast/sound/hello-ogg/Makefile +++ b/examples/dreamcast/sound/hello-ogg/Makefile @@ -19,7 +19,7 @@ clean: # version, and oggvorbisplay is the full FP version. $(TARGET): $(OBJS) kos-cc -o $(TARGET) $(OBJS) $(DATAOBJS) $(OBJEXTRA) -ltremor -lm -# kos-cc -o $(TARGET) $(OBJS) $(DATAOBJS) $(OBJEXTRA) -loggvorbisplay -lm +# kos-cc -o $(TARGET) $(OBJS) $(DATAOBJS) $(OBJEXTRA) -loggvorbisplay -lvorbis -logg -lm romdisk.img: $(KOS_GENROMFS) -f romdisk.img -d romdisk -v hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2015-05-16 23:56:57
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The collection of ports that can be used in KallistiOS programs.". The branch, master has been updated via 4ee46d2027e5c1d41a1d15bb6b79bbbda3941e7a (commit) from cadaed06f2c4d5125d7641ac809e602592f61148 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4ee46d2027e5c1d41a1d15bb6b79bbbda3941e7a Author: Lawrence Sebald <ljs...@us...> Date: Sat May 16 19:56:32 2015 -0400 Remove stray rar file? ----------------------------------------------------------------------- Summary of changes: libgl.rar | Bin 45759 -> 0 bytes 1 files changed, 0 insertions(+), 0 deletions(-) delete mode 100755 libgl.rar diff --git a/libgl.rar b/libgl.rar deleted file mode 100755 index cab7666..0000000 Binary files a/libgl.rar and /dev/null differ hooks/post-receive -- The collection of ports that can be used in KallistiOS programs. |
From: Lawrence S. <ljs...@us...> - 2015-05-09 16:34:01
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "UNNAMED PROJECT". The branch, master has been updated via b4ac19d68082ac7f78101145c15ba1fa64ad6023 (commit) from 7ed60d1e2232e7b4668860215c21ac8857cbf0d1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b4ac19d68082ac7f78101145c15ba1fa64ad6023 Author: Lawrence Sebald <ljs...@us...> Date: Sat May 9 12:33:46 2015 -0400 Fix compilation in new kos-ports. ----------------------------------------------------------------------- Summary of changes: src/animation.cpp | 10 +++++----- src/anims/alphafader.cpp | 4 ++-- src/anims/expxymover.cpp | 6 +++--- src/anims/logxymover.cpp | 2 +- src/anims/tintfader.cpp | 6 +++--- src/drawable.cpp | 11 +++++------ src/drawables/banner.cpp | 7 +++---- src/drawables/label.cpp | 7 +++---- src/font.cpp | 8 ++++---- src/genmenu.cpp | 9 ++++----- src/matrix.cpp | 8 ++++---- src/matrixdouble.cpp | 10 +++++----- src/sound.cpp | 7 +++---- src/texture.cpp | 7 +++---- src/trigger.cpp | 11 +++++------ src/triggers/birth.cpp | 11 +++++------ src/triggers/death.cpp | 11 +++++------ src/vector.cpp | 11 +++++------ src/vector3.cpp | 9 ++++----- src/vectordouble.cpp | 8 ++++---- 20 files changed, 76 insertions(+), 87 deletions(-) diff --git a/src/animation.cpp b/src/animation.cpp index 8820994..f96a723 100644 --- a/src/animation.cpp +++ b/src/animation.cpp @@ -1,13 +1,13 @@ -/* +/* Tsunami for KallistiOS ##version## - + animation.cpp - + (c)2002 Dan Potter */ -#include <tsu/animation.h> -#include <tsu/drawable.h> +#include "animation.h" +#include "drawable.h" Animation::Animation() { } diff --git a/src/anims/alphafader.cpp b/src/anims/alphafader.cpp index 5cf6e00..c7f3b52 100644 --- a/src/anims/alphafader.cpp +++ b/src/anims/alphafader.cpp @@ -6,8 +6,8 @@ (c)2002 Dan Potter */ -#include <tsu/drawable.h> -#include <tsu/anims/alphafader.h> +#include "drawable.h" +#include "anims/alphafader.h" AlphaFader::AlphaFader(float fade_to, float delta) { m_fade_to = fade_to; diff --git a/src/anims/expxymover.cpp b/src/anims/expxymover.cpp index ba8292d..63d7d90 100644 --- a/src/anims/expxymover.cpp +++ b/src/anims/expxymover.cpp @@ -6,8 +6,8 @@ (c)2002 Dan Potter */ -#include <tsu/drawable.h> -#include <tsu/anims/expxymover.h> +#include "drawable.h" +#include "anims/expxymover.h" ExpXYMover::ExpXYMover(float dx, float dy, float maxx, float maxy) { m_dx = dx; @@ -20,7 +20,7 @@ ExpXYMover::~ExpXYMover() { } void ExpXYMover::nextFrame(Drawable *t) { Vector p = t->getTranslate(); - + bool xfin = m_dx < 0 ? (p.x <= m_maxx) : (p.x >= m_maxx); bool yfin = m_dy < 0 ? (p.y <= m_maxy) : (p.y >= m_maxy); if (xfin && yfin) { diff --git a/src/anims/logxymover.cpp b/src/anims/logxymover.cpp index 9ffa66c..b22bb97 100644 --- a/src/anims/logxymover.cpp +++ b/src/anims/logxymover.cpp @@ -6,7 +6,7 @@ (c)2002 Dan Potter */ -#include <tsu/anims/logxymover.h> +#include "anims/logxymover.h" #include <math.h> LogXYMover::LogXYMover(float dstx, float dsty) { diff --git a/src/anims/tintfader.cpp b/src/anims/tintfader.cpp index 9212dca..8da7bb8 100644 --- a/src/anims/tintfader.cpp +++ b/src/anims/tintfader.cpp @@ -6,8 +6,8 @@ Copyright (C)2003 Dan Potter */ -#include <tsu/drawable.h> -#include <tsu/anims/tintfader.h> +#include "drawable.h" +#include "anims/tintfader.h" TintFader::TintFader(const Color & fade_to, const Color & delta) { m_fade_to = fade_to; @@ -19,7 +19,7 @@ TintFader::~TintFader() { } void TintFader::nextFrame(Drawable *t) { Color c = t->getTint(); c += m_delta; - + if (clamp(c)) { c = m_fade_to; complete(t); diff --git a/src/drawable.cpp b/src/drawable.cpp index b0cce91..ed88456 100644 --- a/src/drawable.cpp +++ b/src/drawable.cpp @@ -1,12 +1,12 @@ -/* +/* Tsunami for KallistiOS ##version## drawable.cpp - + (c)2002 Dan Potter */ -#include <tsu/drawable.h> +#include "drawable.h" #include <plx/matrix.h> // Constructor / Destructor @@ -20,13 +20,13 @@ Drawable::Drawable() { m_r_prelative = true; m_s_prelative = true; m_a_prelative = true; - + m_finished = false; m_subs_finished = false; m_parent = NULL; } - + Drawable::~Drawable() { } @@ -177,4 +177,3 @@ void Drawable::pushTransformMatrix() const { void Drawable::popTransformMatrix() const { plx_mat3d_pop(); } - diff --git a/src/drawables/banner.cpp b/src/drawables/banner.cpp index 5cf833c..ca08704 100644 --- a/src/drawables/banner.cpp +++ b/src/drawables/banner.cpp @@ -1,17 +1,17 @@ /* Tsunami for KallistiOS ##version## - + banner.cpp (c)2002 Dan Potter */ -#include <tsu/drawables/banner.h> +#include "drawables/banner.h" Banner::Banner(int list, Texture * texture) { m_list = list; m_texture = texture; - + m_u1 = m_v2 = 0.0f; m_u2 = m_v4 = 0.0f; m_u3 = m_v1 = 1.0f; @@ -99,4 +99,3 @@ void Banner::draw(int list) { Drawable::draw(list); } - diff --git a/src/drawables/label.cpp b/src/drawables/label.cpp index 04f8763..73ce0e4 100644 --- a/src/drawables/label.cpp +++ b/src/drawables/label.cpp @@ -1,13 +1,13 @@ /* Tsunami for KallistiOS ##version## - + label.cpp (c)2002 Dan Potter */ #include <plx/list.h> -#include <tsu/drawables/label.h> +#include "drawables/label.h" Label::Label(Font * fh, const char *text, int size, bool centered, bool smear) { m_fh = fh; @@ -15,7 +15,7 @@ Label::Label(Font * fh, const char *text, int size, bool centered, bool smear) { m_size = size; m_centered = centered; m_smear = smear; - + } Label::~Label() { } @@ -50,4 +50,3 @@ void Label::draw(int list) { m_fh->draw(p.x, p.y, p.z, m_text); } } - diff --git a/src/font.cpp b/src/font.cpp index c9111bc..b8e9b30 100644 --- a/src/font.cpp +++ b/src/font.cpp @@ -1,12 +1,12 @@ -/* +/* Tsunami for KallistiOS ##version## - + font.cpp (c)2002 Dan Potter */ -#include <tsu/font.h> +#include "font.h" Font::Font(const char *fn, int list) { m_list = list; @@ -153,7 +153,7 @@ void Font::smearDraw(float x, float y, float z, const char *text) { plx_fcxt_draw(m_cxt, text); plx_fcxt_setpos(m_cxt, x + 0, y + 0, z - 1.0f); plx_fcxt_draw(m_cxt, text); - + plx_fcxt_end(m_cxt); plx_fcxt_setcolor4f(m_cxt, m_a, m_r, m_g, m_b); } diff --git a/src/genmenu.cpp b/src/genmenu.cpp index 24a8bad..31b4099 100644 --- a/src/genmenu.cpp +++ b/src/genmenu.cpp @@ -6,7 +6,7 @@ Copyright (C)2003 Dan Potter */ -/* +/* This module implements a generic menu system. There are some pieces here that were more integrated into Feet of Fury which have been commented out for the moment until they can be more properly sorted out. @@ -26,7 +26,7 @@ */ -#include <tsu/genmenu.h> +#include "genmenu.h" #include <plx/list.h> #include <kos/thread.h> #include <arch/timer.h> @@ -38,7 +38,7 @@ GenericMenu::GenericMenu() { m_bgmFn[0] = 0; m_usebgm = false; m_cachebgm = false; - + m_bg[0] = m_bg[1] = m_bg[2] = 0.0f; m_exiting = false; @@ -92,7 +92,7 @@ void GenericMenu::doMenu() { // Did we get a quit-now request? if (!m_exitSpeed) return; - + // We should be faded out now -- do three more frames to finish // clearing out the PVR buffered scenes. m_exitCount = 0; @@ -438,4 +438,3 @@ void GenericMenu::setAutoRepeat(GenericMenu::Event::KeyConstant key, bool enable else m_autoRep &= ~(1 << key); } - diff --git a/src/matrix.cpp b/src/matrix.cpp index 1a5df4e..6627a89 100644 --- a/src/matrix.cpp +++ b/src/matrix.cpp @@ -1,13 +1,13 @@ -/* +/* Tsunami for KallistiOS ##version## - + matrix.cpp Copyright (C)2001,2002,2003 Dan Potter Copyright (C)2002 Benoit Miller and Paul Boese */ -#include <tsu/matrix.h> +#include "matrix.h" #include <string.h> /* Several pieces of this file were pulled from libparallax, which was @@ -56,7 +56,7 @@ void Matrix::rotate(float angle, const Vector & axis) { // Normalize the rotation vector vx /= mag; - vy /= mag; + vy /= mag; vz /= mag; xx = vx * vx; diff --git a/src/matrixdouble.cpp b/src/matrixdouble.cpp index 583cbfd..f06796a 100644 --- a/src/matrixdouble.cpp +++ b/src/matrixdouble.cpp @@ -1,14 +1,14 @@ -/* +/* Tsunami for KallistiOS ##version## - + matrixdouble.cpp Copyright (C)2001,2002,2003 Dan Potter Copyright (C)2002 Benoit Miller and Paul Boese */ -#include <tsu/matrixdouble.h> -#include <tsu/matrix.h> +#include "matrixdouble.h" +#include "matrix.h" #include <string.h> /* Several pieces of this file were pulled from libparallax, which was @@ -59,7 +59,7 @@ void MatrixDouble::rotate(double angle, const VectorDouble & axis) { // Normalize the rotation vector vx /= mag; - vy /= mag; + vy /= mag; vz /= mag; xx = vx * vx; diff --git a/src/sound.cpp b/src/sound.cpp index 3d4c8ca..4c92440 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -1,12 +1,12 @@ -/* +/* Tsunami for KallistiOS ##version## - + sound.cpp (c)2002 Dan Potter */ -#include <tsu/sound.h> +#include "sound.h" int Sound::m_default_vol = 240; @@ -52,4 +52,3 @@ bool Sound::loadFromFile(const char *fn) { void Sound::setDefaultVolume(int vol) { m_default_vol = vol; } - diff --git a/src/texture.cpp b/src/texture.cpp index 2dffef6..49b2ad4 100644 --- a/src/texture.cpp +++ b/src/texture.cpp @@ -1,12 +1,12 @@ -/* +/* Tsunami for KallistiOS ##version## - + texture.cpp (c)2002 Dan Potter */ -#include <tsu/texture.h> +#include "texture.h" Texture::Texture(const char *fn, bool use_alpha, bool yflip) { m_txr = NULL; @@ -52,4 +52,3 @@ bool Texture::loadFromFile(const char *fn, bool use_alpha, bool flip) { } else return true; } - diff --git a/src/trigger.cpp b/src/trigger.cpp index 5bc0b09..0dbbcbb 100644 --- a/src/trigger.cpp +++ b/src/trigger.cpp @@ -1,13 +1,13 @@ -/* +/* Tsunami for KallistiOS ##version## - + trigger.cpp - + (c)2002 Dan Potter */ -#include <tsu/trigger.h> -#include <tsu/animation.h> +#include "trigger.h" +#include "animation.h" Trigger::Trigger() { } @@ -19,4 +19,3 @@ void Trigger::trigger(Drawable *t, Animation *a) { // Autoclean ourselves once we've triggered a->triggerRemove(this); } - diff --git a/src/triggers/birth.cpp b/src/triggers/birth.cpp index b00c985..e792498 100644 --- a/src/triggers/birth.cpp +++ b/src/triggers/birth.cpp @@ -1,13 +1,13 @@ -/* +/* Tsunami for KallistiOS ##version## - + birth.cpp - + Copyright (C)2003 Dan Potter */ -#include <tsu/triggers/birth.h> -#include <tsu/drawable.h> +#include "triggers/birth.h" +#include "drawable.h" Birth::Birth(Drawable * newDrawable, Drawable * target) { m_newDrawable = newDrawable; @@ -27,4 +27,3 @@ void Birth::trigger(Drawable *t, Animation *a) { // Remove ourselves Trigger::trigger(t, a); } - diff --git a/src/triggers/death.cpp b/src/triggers/death.cpp index 8d9a7f5..a4c0033 100644 --- a/src/triggers/death.cpp +++ b/src/triggers/death.cpp @@ -1,13 +1,13 @@ -/* +/* Tsunami for KallistiOS ##version## - + death.cpp - + (c)2002 Dan Potter */ -#include <tsu/triggers/death.h> -#include <tsu/drawable.h> +#include "triggers/death.h" +#include "drawable.h" Death::Death(Drawable * target) { m_target = target; @@ -26,4 +26,3 @@ void Death::trigger(Drawable *t, Animation *a) { // Go the way of the dodo ourselves Trigger::trigger(t, a); } - diff --git a/src/vector.cpp b/src/vector.cpp index 1b1f911..fbef587 100644 --- a/src/vector.cpp +++ b/src/vector.cpp @@ -1,14 +1,14 @@ -/* +/* Tsunami for KallistiOS ##version## - + vector.cpp Copyright (C)2004 Dan Potter */ -#include <tsu/vector.h> ...<truncated>... hooks/post-receive -- UNNAMED PROJECT |
From: Lawrence S. <ljs...@us...> - 2015-05-09 16:27:30
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "UNNAMED PROJECT". The branch, master has been updated via ab4993aa4ff611690f777fdf29e5747392c13482 (commit) from 4db5606797c628c29fdf9c97acf28988ac46edf9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ab4993aa4ff611690f777fdf29e5747392c13482 Author: Lawrence Sebald <ljs...@us...> Date: Sat May 9 12:27:17 2015 -0400 Fix libparallax for new kos-ports. ----------------------------------------------------------------------- Summary of changes: src/context.c | 2 +- src/font.c | 8 ++++---- src/mat3d.c | 5 ++--- src/texture.c | 4 ++-- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/context.c b/src/context.c index 3b3de60..cdefc15 100644 --- a/src/context.c +++ b/src/context.c @@ -10,7 +10,7 @@ #include <stdio.h> #include <string.h> -#include <plx/context.h> +#include "context.h" /* See the header file for all comments and documentation */ diff --git a/src/font.c b/src/font.c index 4142050..6ae612f 100644 --- a/src/font.c +++ b/src/font.c @@ -11,8 +11,8 @@ #include <string.h> #include <stdlib.h> #include <kos/fs.h> -#include <plx/font.h> -#include <plx/prim.h> +#include "font.h" +#include "prim.h" /* See the header file for all comments and documentation */ @@ -294,7 +294,7 @@ fail_1: /* Only the file is open */ void plx_font_destroy(plx_font_t * fnt) { assert( fnt != NULL ); if (fnt == NULL) return; - + assert( fnt->txr != NULL ); if (fnt->txr != NULL) plx_txr_destroy(fnt->txr); @@ -389,7 +389,7 @@ void plx_fcxt_char_metrics(plx_fcxt_t * cxt, uint16 ch, *outright = (cxt->gap + fnt->vert_ur[g].x) * cxt->size; *outdown = fnt->vert_ll[g].y * -cxt->size; } - + void plx_fcxt_str_metrics(plx_fcxt_t * cxt, const char * str, float * outleft, float * outup, float * outright, float *outdown) { diff --git a/src/mat3d.c b/src/mat3d.c index dee1ffc..240c03f 100644 --- a/src/mat3d.c +++ b/src/mat3d.c @@ -10,7 +10,7 @@ #include <dc/fmath.h> #include <dc/matrix.h> #include <dc/video.h> -#include <plx/matrix.h> +#include "matrix.h" /* Most of this file was pulled from KGL's gltrans.c. Why did we do that @@ -107,7 +107,7 @@ void plx_mat3d_viewport(int x1, int y1, int width, int height) { } /* Setup perspective */ -void plx_mat3d_perspective(float angle, float aspect, +void plx_mat3d_perspective(float angle, float aspect, float znear, float zfar) { float xmin, xmax, ymin, ymax; @@ -440,4 +440,3 @@ void plx_mat3d_init() { plx_mat3d_viewport(0, 0, vid_mode->width, vid_mode->height); vp_z_fudge = 0.0f; } - diff --git a/src/texture.c b/src/texture.c index 73e2214..db09bae 100644 --- a/src/texture.c +++ b/src/texture.c @@ -10,7 +10,7 @@ #include <stdio.h> #include <string.h> #include <stdlib.h> -#include <plx/texture.h> +#include "texture.h" #include <png/png.h> #include <jpeg/jpeg.h> #include <kmg/kmg.h> @@ -173,7 +173,7 @@ void plx_txr_setfilter(plx_texture_t * txr, int mode) { void plx_txr_setuvclamp(plx_texture_t * txr, int umode, int vmode) { int mode; - + assert( txr != NULL ); if (txr == NULL) return; hooks/post-receive -- UNNAMED PROJECT |
From: Lawrence S. <ljs...@us...> - 2015-05-09 16:22:15
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "An image loading library.". The branch, master has been updated via 0b66623cea623ac7478b501704af432c57e0475a (commit) from 324ededdab421cfefcfd380c2b77f24f2e3d8c5b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 0b66623cea623ac7478b501704af432c57e0475a Author: Lawrence Sebald <ljs...@us...> Date: Sat May 9 12:21:59 2015 -0400 Fix libimageload for the new kos-ports. ----------------------------------------------------------------------- Summary of changes: imageload.c | 14 +++--- include/imageload.h | 3 - jitter.c | 4 +- readbmp.c | 116 +++++++++++++++++++++++++-------------------------- readjpeg.c | 21 +++++---- 5 files changed, 77 insertions(+), 81 deletions(-) diff --git a/imageload.c b/imageload.c index d508abb..4e48a49 100644 --- a/imageload.c +++ b/imageload.c @@ -1,4 +1,4 @@ -#include <imageload/imageload.h> +#include "imageload.h" #include <string.h> #include <malloc.h> @@ -31,12 +31,12 @@ img_copy_texture(uint16 *dest, uint8 *source, uint32 channels, uint32 stride, uint16 *destRow; uint8 *pRow; uint8 r,g,b; - + for(i = 0; i < h; i++) { pRow = &source[i*stride]; destRow = &dest[i*w]; - + if (channels == 3) { switch(info->alpha) @@ -233,7 +233,7 @@ int img_load_file(const char *filename, IMG_INFO *info, kos_img_t *img) info->type = img_guess(filename); img_load_data(f,info,img); - + fclose(f); return 0; @@ -244,7 +244,7 @@ int img_load_data(FILE *f, IMG_INFO *info, kos_img_t *img) uint32 channels, rowBytes; uint8 *data = NULL; uint8 allocate = 0; - + if (info == NULL) { allocate = 1; @@ -252,7 +252,7 @@ int img_load_data(FILE *f, IMG_INFO *info, kos_img_t *img) memset(&info,0,sizeof(IMG_INFO)); } - + switch(info->type) { case IMG_FILE_GUESS: @@ -321,6 +321,6 @@ int img_load_data(FILE *f, IMG_INFO *info, kos_img_t *img) img->fmt = KOS_IMG_FMT(KOS_IMG_FMT_ARGB4444, 0); break; } - + return 0; } diff --git a/include/imageload.h b/include/imageload.h index bbe82cb..fec2cc4 100644 --- a/include/imageload.h +++ b/include/imageload.h @@ -2,9 +2,6 @@ #define __IMAGELOAD_H__ #include <kos.h> -#include <imageload/jitterdefs.h> - -#include <stdio.h> typedef enum { diff --git a/jitter.c b/jitter.c index 7a94798..64c9f7f 100644 --- a/jitter.c +++ b/jitter.c @@ -1,4 +1,4 @@ -#include <imageload/jitterdefs.h> +#include "jitterdefs.h" #include <stdlib.h> @@ -22,7 +22,7 @@ unsigned char jitter(unsigned char c, unsigned char n, unsigned char shift, unsi { const unsigned char lowbit = 1 << shift; unsigned int p,q; - + if (c < 248) { p = c % lowbit; diff --git a/readbmp.c b/readbmp.c index 849cb9d..b520d24 100644 --- a/readbmp.c +++ b/readbmp.c @@ -3,8 +3,6 @@ #include <stdio.h> #include <stdlib.h> -#include <imageload/imageload.h> - #pragma pack(1) #define BI_RGB 0 @@ -12,37 +10,37 @@ #define BI_RLE4 2 #define BI_BITFIELDS 3 -typedef struct { - uint16 bfType; - uint32 bfSize; - uint16 bfReserved1; - uint16 bfReserved2; - uint32 bfOffBits; -} BITMAPFILEHEADER; - -typedef struct { - uint32 bcSize; - uint16 bcWidth; - uint16 bcHeight; - uint16 bcPlanes; - uint16 bcBitCount; +typedef struct { + uint16 bfType; + uint32 bfSize; + uint16 bfReserved1; + uint16 bfReserved2; + uint32 bfOffBits; +} BITMAPFILEHEADER; + +typedef struct { + uint32 bcSize; + uint16 bcWidth; + uint16 bcHeight; + uint16 bcPlanes; + uint16 bcBitCount; } BITMAPCOREHEADER; typedef struct tagBITMAPINFOHEADER { - uint32 biSize; - int32 biWidth; - int32 biHeight; - uint16 biPlanes; - uint16 biBitCount; - uint32 biCompression; - uint32 biSizeImage; - int32 biXPelsPerMeter; - int32 biYPelsPerMeter; - uint32 biClrUsed; - uint32 biClrImportant; + uint32 biSize; + int32 biWidth; + int32 biHeight; + uint16 biPlanes; + uint16 biBitCount; + uint32 biCompression; + uint32 biSizeImage; + int32 biXPelsPerMeter; + int32 biYPelsPerMeter; + uint32 biClrUsed; + uint32 biClrImportant; } BITMAPINFOHEADER; - -typedef struct + +typedef struct { uint8 rgbBlue; uint8 rgbGreen; @@ -73,7 +71,7 @@ uint8 *readbmp_get_image(uint32 *pChannels, uint32 *pRowbytes, uint32 skip, r, g, b, k; uint32 x, y; uint8 byte; - + /* read the BITMAPFILEHEADER */ uint32 bytesRead = fread(&bitmapFile, 1, sizeof(BITMAPFILEHEADER), bmpfile); if ( bytesRead != sizeof(BITMAPFILEHEADER) || @@ -86,7 +84,7 @@ uint8 *readbmp_get_image(uint32 *pChannels, uint32 *pRowbytes, bytesRead = fread(&bitmapInfo, 1, sizeof(BITMAPINFOHEADER), bmpfile); if ( bytesRead != sizeof(BITMAPINFOHEADER) || bitmapInfo.biSize == sizeof(BITMAPCOREHEADER)) - { + { return NULL; } @@ -118,11 +116,11 @@ uint8 *readbmp_get_image(uint32 *pChannels, uint32 *pRowbytes, if (bitmapFile.bfOffBits != 0) fseek(bmpfile,bitmapFile.bfOffBits,SEEK_SET); - + imageBuffer = malloc(sizeof(uint8)*bitmapInfo.biSizeImage); buffer = imageBuffer; bytesRead = fread(buffer, 1, bitmapInfo.biSizeImage, bmpfile); - + if ( bytesRead != bitmapInfo.biSizeImage*sizeof(uint8)) { free(colorTable); @@ -135,14 +133,14 @@ uint8 *readbmp_get_image(uint32 *pChannels, uint32 *pRowbytes, *pWidth = bitmapInfo.biWidth; *pHeight = bitmapInfo.biHeight; ourbuffer = (uint8*)malloc(*pRowbytes**pHeight); - - if (bitmapInfo.biCompression == BI_BITFIELDS) + + if (bitmapInfo.biCompression == BI_BITFIELDS) { int bit; rmask = ((unsigned int *)colorTable)[0]; gmask = ((unsigned int *)colorTable)[1]; bmask = ((unsigned int *)colorTable)[2]; - for (bit = bitmapInfo.biBitCount - 1; bit >= 0; bit--) + for (bit = bitmapInfo.biBitCount - 1; bit >= 0; bit--) { if (bmask & (1 << bit)) bshift = bit; @@ -150,9 +148,9 @@ uint8 *readbmp_get_image(uint32 *pChannels, uint32 *pRowbytes, gshift = bit; if (rmask & (1 << bit)) rshift = bit; - } + } } - else if (bitmapInfo.biBitCount == 16) + else if (bitmapInfo.biBitCount == 16) { rmask = 0x7C00; gmask = 0x03E0; @@ -161,7 +159,7 @@ uint8 *readbmp_get_image(uint32 *pChannels, uint32 *pRowbytes, gshift = 5; bshift = 0; } - else if (bitmapInfo.biBitCount == 32) + else if (bitmapInfo.biBitCount == 32) { rmask = 0x00FF0000; gmask = 0x0000FF00; @@ -170,10 +168,10 @@ uint8 *readbmp_get_image(uint32 *pChannels, uint32 *pRowbytes, gshift = 8; bshift = 0; } - + /* for now we will not handle RLE encoded data */ - if (bitmapInfo.biBitCount == 4) + if (bitmapInfo.biBitCount == 4) { if (bitmapInfo.biCompression == BI_RLE4) { @@ -183,13 +181,13 @@ uint8 *readbmp_get_image(uint32 *pChannels, uint32 *pRowbytes, return NULL; } else - if (bitmapInfo.biCompression == BI_RGB) + if (bitmapInfo.biCompression == BI_RGB) { skip = ((((bitmapInfo.biWidth + 7) / 8) * 8) - bitmapInfo.biWidth) / 2; byte = 0; - for (y = 0; y < bitmapInfo.biHeight; y++) + for (y = 0; y < bitmapInfo.biHeight; y++) { - for (x = 0; x < bitmapInfo.biWidth; x++) + for (x = 0; x < bitmapInfo.biWidth; x++) { if ((x & 1) == 0) byte = *(buffer++); @@ -203,7 +201,7 @@ uint8 *readbmp_get_image(uint32 *pChannels, uint32 *pRowbytes, } } } - if (bitmapInfo.biBitCount == 8) + if (bitmapInfo.biBitCount == 8) { if (bitmapInfo.biCompression == BI_RLE8) { @@ -212,13 +210,13 @@ uint8 *readbmp_get_image(uint32 *pChannels, uint32 *pRowbytes, free(ourbuffer); return NULL; } - else - if (bitmapInfo.biCompression == BI_RGB) + else + if (bitmapInfo.biCompression == BI_RGB) { skip = (((bitmapInfo.biWidth + 3) / 4) * 4) - bitmapInfo.biWidth; - for (y = 0; y < bitmapInfo.biHeight; y++) + for (y = 0; y < bitmapInfo.biHeight; y++) { - for (x = 0; x < bitmapInfo.biWidth; x++) + for (x = 0; x < bitmapInfo.biWidth; x++) { byte = *(buffer++); ourbuffer[(bitmapInfo.biHeight-y-1)**pRowbytes+3*x] = colorTable[byte].rgbRed; @@ -229,12 +227,12 @@ uint8 *readbmp_get_image(uint32 *pChannels, uint32 *pRowbytes, } } } - else if (bitmapInfo.biBitCount == 16) + else if (bitmapInfo.biBitCount == 16) { skip = (((bitmapInfo.biWidth * 16 + 31) / 32) * 4) - (bitmapInfo.biWidth * 2); - for (y = 0; y < bitmapInfo.biHeight; y++) + for (y = 0; y < bitmapInfo.biHeight; y++) { - for (x = 0; x < bitmapInfo.biWidth; x++) + for (x = 0; x < bitmapInfo.biWidth; x++) { r = ((uint16)(*buffer) & rmask) >> rshift; g = ((uint16)(*buffer) & gmask) >> gshift; @@ -247,12 +245,12 @@ uint8 *readbmp_get_image(uint32 *pChannels, uint32 *pRowbytes, buffer += skip; } } - else if (bitmapInfo.biBitCount == 24) + else if (bitmapInfo.biBitCount == 24) { skip = (4 - ((bitmapInfo.biWidth * 3) % 4)) & 3; - for (y = 0; y < bitmapInfo.biHeight; y++) + for (y = 0; y < bitmapInfo.biHeight; y++) { - for (x = 0; x < bitmapInfo.biWidth; x++) + for (x = 0; x < bitmapInfo.biWidth; x++) { b = *(buffer++); g = *(buffer++); @@ -265,12 +263,12 @@ uint8 *readbmp_get_image(uint32 *pChannels, uint32 *pRowbytes, buffer += skip; } } - else if (bitmapInfo.biBitCount == 32) + else if (bitmapInfo.biBitCount == 32) { skip = (((bitmapInfo.biWidth * 32 + 31) / 32) * 4) - (bitmapInfo.biWidth * 4); - for (y = 0; y < bitmapInfo.biHeight; y++) + for (y = 0; y < bitmapInfo.biHeight; y++) { - for (x = 0; x < bitmapInfo.biWidth; x++) + for (x = 0; x < bitmapInfo.biWidth; x++) { r = ((uint32)(*buffer) & rmask) >> rshift; g = ((uint32)(*buffer) & gmask) >> gshift; @@ -279,7 +277,7 @@ uint8 *readbmp_get_image(uint32 *pChannels, uint32 *pRowbytes, ourbuffer[(bitmapInfo.biHeight-y-1)**pRowbytes+3*x] = r; ourbuffer[(bitmapInfo.biHeight-y-1)**pRowbytes+3*x+1] = g; ourbuffer[(bitmapInfo.biHeight-y-1)**pRowbytes+3*x+2] = b; - + buffer+=2; } buffer += skip; diff --git a/readjpeg.c b/readjpeg.c index 327291a..99c4a52 100644 --- a/readjpeg.c +++ b/readjpeg.c @@ -1,6 +1,7 @@ #include <stdio.h> #include <string.h> -#include "../libjpeg/jpeglib.h" +#include <stdlib.h> +#include <jpeg/jpeglib.h> static struct jpeg_decompress_struct cinfo; static struct jpeg_error_mgr jerr; @@ -8,25 +9,25 @@ static struct jpeg_error_mgr jerr; uint32 readjpeg_init(FILE *infile) { /* Step 1: allocate and initialize JPEG decompression object */ - + /* We set up the normal JPEG error routines */ cinfo.err = jpeg_std_error(&jerr); - + /* Now we can initialize the JPEG decompression object. */ jpeg_create_decompress(&cinfo); - + /* Step 2: specify data source (eg, a file) */ - jpeg_stdio_src(&cinfo, infile); + jpeg_stdio_src(&cinfo, infile); (void) jpeg_read_header(&cinfo, TRUE); - + /* Step 4: set parameters for decompression */ - + cinfo.scale_denom = 1; /* must be 1, 2, 4, or 8 */ /* Step 5: Start decompressor */ (void) jpeg_start_decompress(&cinfo); - + return 0; } @@ -42,7 +43,7 @@ uint8 *readjpeg_get_image(uint32 *pChannels, uint32 *pRowbytes, uint32 *pWidth, *pChannels = cinfo.output_components; *pWidth = cinfo.output_width; *pHeight = cinfo.output_height; - + ourbuffer = (uint8 *)malloc(*pRowbytes**pHeight); buffer = (*cinfo.mem->alloc_sarray)((j_common_ptr) &cinfo, JPOOL_IMAGE, *pRowbytes, 1); @@ -52,7 +53,7 @@ uint8 *readjpeg_get_image(uint32 *pChannels, uint32 *pRowbytes, uint32 *pWidth, (void) jpeg_read_scanlines(&cinfo, buffer, 1); memcpy(&ourbuffer[i**pRowbytes], buffer[0], *pRowbytes); } - + return ourbuffer; } hooks/post-receive -- An image loading library. |
From: Lawrence S. <ljs...@us...> - 2015-05-09 03:10:04
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "UNNAMED PROJECT". The branch, master has been updated via 96f71f6868564925313769556e60788781df0818 (commit) from 85ce519a5c80ef031529adb0fee716b2e0f50e5d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 96f71f6868564925313769556e60788781df0818 Author: Lawrence Sebald <ljs...@us...> Date: Fri May 8 23:09:52 2015 -0400 Fix compilation in new kos-ports. ----------------------------------------------------------------------- Summary of changes: Makefile | 1 + tga.c | 4 ++-- tga_texture.c | 5 ++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 0b84269..7e527a3 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,7 @@ TARGET = libtga.a OBJS = tga.o +KOS_CFLAGS += -Iinclude all: create_kos_link defaultall diff --git a/tga.c b/tga.c index 705cd96..152991b 100644 --- a/tga.c +++ b/tga.c @@ -14,8 +14,8 @@ */ #include <kos.h> -#include <tga/tga.h> #include <assert.h> +#include "tga.h" typedef struct { uint8 image_id_length __attribute__((packed)); /* Length of Image ID field */ @@ -91,7 +91,7 @@ int tga_to_img(const char *fn, kos_img_t *rv) { fs_read(fd, &g, 1); fs_read(fd, &r, 1); fs_read(fd, &a, 1); - + /* Cheap scaling to ARGB4444 */ a = a >> 4 & 0x0f; r = r >> 4 & 0x0f; diff --git a/tga_texture.c b/tga_texture.c index 66701d0..1ec0d1c 100644 --- a/tga_texture.c +++ b/tga_texture.c @@ -7,9 +7,9 @@ */ #include <kos.h> -#include <tga/tga.h> +#include "tga.h" -/* Loads a TGA file into texture RAM, potentially twiddling it. +/* Loads a TGA file into texture RAM, potentially twiddling it. TGA files already include an alpha channel. */ int tga_load_texture(const char *fn, int twiddle, uint32 *txr_out, int *w, int *h) { kos_img_t img; @@ -36,4 +36,3 @@ int tga_load_texture(const char *fn, int twiddle, uint32 *txr_out, int *w, int * return 0; } - hooks/post-receive -- UNNAMED PROJECT |
From: Lawrence S. <ljs...@us...> - 2015-05-09 03:08:25
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "UNNAMED PROJECT". The branch, master has been updated via 459688b5d2255395c6c99341e7aa68723a101cac (commit) from 23a654d9e8f4bdb160dc4ded438676f2ae6d2793 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 459688b5d2255395c6c99341e7aa68723a101cac Author: Lawrence Sebald <ljs...@us...> Date: Fri May 8 23:08:13 2015 -0400 Fix compilation in new kos-ports. ----------------------------------------------------------------------- Summary of changes: Makefile | 2 +- pcx.c | 10 +++++----- pcx_texture.c | 5 ++--- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 6e9206f..dcf2020 100755 --- a/Makefile +++ b/Makefile @@ -5,6 +5,7 @@ TARGET = libpcx.a OBJS = pcx.o +KOS_CFLAGS += -Iinclude all: create_kos_link defaultall @@ -14,4 +15,3 @@ create_kos_link: ln -s ../libpcx/include ../include/pcx include $(KOS_BASE)/addons/Makefile.prefab - diff --git a/pcx.c b/pcx.c index 40a7ff6..66052ca 100644 --- a/pcx.c +++ b/pcx.c @@ -7,8 +7,8 @@ */ #include <kos.h> -#include <pcx/pcx.h> #include <assert.h> +#include "pcx.h" typedef struct { char mfg; /* manufacturer, always 0xa0 */ @@ -90,21 +90,21 @@ int pcx_to_img(const char *fn, kos_img_t *rv) { else image[bytes++] = c; } while (bytes < num_bytes); - + /* Load the palette */ fs_read(fd, &c, 1); /* This is a marker before the palette */ pcxpal = image + num_bytes; fs_read(fd, pcxpal, 768); fs_close(fd); - + /* Decode the image into RGB565 */ for (i=0; i<num_bytes; i++) { v = image[i]; r = pcxpal[v*3+0]; g = pcxpal[v*3+1]; b = pcxpal[v*3+2]; - + v = (((r >> 3) & 0x1f) << 11) | (((g >> 2) & 0x3f) << 5) | (((b >> 3) & 0x1f) << 0); @@ -113,6 +113,6 @@ int pcx_to_img(const char *fn, kos_img_t *rv) { /* Free temp buffers */ free(image); - + return 0; } diff --git a/pcx_texture.c b/pcx_texture.c index 2047858..e6bbf2a 100644 --- a/pcx_texture.c +++ b/pcx_texture.c @@ -7,7 +7,7 @@ */ #include <kos.h> -#include <pcx/pcx.h> +#include "pcx.h" /* Adjusts a 16-bit image so that instead of RGB565 gray scales, you will have ARGB4444 alpha scales. The resulting image will be entirely white. */ @@ -15,7 +15,7 @@ static void _txr_to_alpha(uint16 *img, int x, int y) { int i; short v; - + for (i=0; i<x*y; i++) { v = img[i] & 0x1f; v = ((v >> 1) << 12) | 0x0fff; @@ -56,4 +56,3 @@ int pcx_load_texture(const char *fn, int twiddle, int alpha, return 0; } - hooks/post-receive -- UNNAMED PROJECT |