Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add Marcan's updates

git-svn-id: https://devkitpro.svn.sourceforge.net/svnroot/devkitpro/trunk/libogc@2712 258c5a1a-4f63-435d-9564-e8f6d34ab52c
  • Loading branch information...
commit fa792f31bfd3101f67e2c9ae80b1ea383854f67c 1 parent f962591
wntrmute authored
View
10 gc/ogc/consol.h
@@ -53,6 +53,16 @@ s32 CON_InitEx(GXRModeObj *rmode, s32 conXOrigin,s32 conYOrigin,s32 conWidth,s32
*/
void CON_GetMetrics(int *cols, int *rows);
+/*!
+ * \fn CON_GetPosition(int *col, int *row)
+ * \brief retrieve the current cursor position of the current console
+ *
+ * \param[out] col,row current cursor position
+ *
+ * \return none
+ */
+void CON_GetPosition(int *cols, int *rows);
+
#ifdef __cplusplus
}
#endif
View
1  gc/wiiuse/wiiuse.h
@@ -341,6 +341,7 @@ typedef struct sb_t {
fdot_t rot_dots[2];
float angle;
float off_angle;
+ float score;
} sb_t;
/**
View
2  libogc.prj
@@ -94,7 +94,7 @@ Open File Line16=0
Open File Window Pos16=0,1,-1,-1,-4,-30,66,87,1099,457
Open File17=
[File View]
-Current Select=Project Files\gc\ogc\gx.h
+Current Select=Project Files\libogc\video.c
Scroll Position=0
[Files - libogc]
View
14 libogc/console.c
@@ -518,8 +518,10 @@ void CON_Init(void *framebuffer,int xstart,int ystart,int xres,int yres,int stri
s32 CON_InitEx(GXRModeObj *rmode, s32 conXOrigin,s32 conYOrigin,s32 conWidth,s32 conHeight)
{
- if(_console_buffer) return 0;
-
+ VIDEO_SetPostRetraceCallback(NULL);
+ if(_console_buffer)
+ free(_console_buffer);
+
_console_buffer = malloc(conWidth*conHeight*VI_DISPLAY_PIX_SZ);
if(!_console_buffer) return -1;
@@ -536,4 +538,12 @@ void CON_GetMetrics(int *cols, int *rows)
}
}
+void CON_GetPosition(int *col, int *row)
+{
+ if(curr_con) {
+ *col = curr_con->cursor_col;
+ *row = curr_con->cursor_row;
+ }
+}
+
View
1  libogc/gu_psasm.S
@@ -323,6 +323,7 @@ ps_guMtxTrans:
addi r9,r9,Unit01@l
lfs fr4,0(r9)
lfs fr5,4(r9)
+ stfs fr4,16(r3)
stfs fr1,12(r3)
stfs fr2,28(r3)
psq_st fr4,4(r3),0,0
View
2  libogc/system.c
@@ -195,7 +195,7 @@ extern void __reset(u32 reset_code);
extern void __UnmaskIrq(u32);
extern void __MaskIrq(u32);
-extern u32 __IPC_ClntInit();
+extern u32 __IPC_ClntInit(void);
extern u32 __PADDisableRecalibration(s32 disable);
extern void __console_init_ex(void *conbuffer,int tgt_xstart,int tgt_ystart,int tgt_stride,int con_xres,int con_yres,int con_stride);
View
15 wiiuse/ir.c
@@ -437,8 +437,8 @@ enum {
// half-height of the IR sensor if half-width is 1
#define HEIGHT (384.0f / 512.0f)
-// maximum sensor bar slope (tan(20 degrees))
-#define MAX_SB_SLOPE 0.36f
+// maximum sensor bar slope (tan(35 degrees))
+#define MAX_SB_SLOPE 0.7f
// minimum sensor bar width in view, relative to half of the IR sensor area
#define MIN_SB_WIDTH 0.1f
// reject "sensor bars" that happen to have a dot towards the middle
@@ -588,6 +588,9 @@ void find_sensorbar(struct ir_t* ir, struct orient_t *orient) {
// failed middle dot check
if(i < ir->num_dots) continue;
WIIUSE_DEBUG("IR: passed middle dot check\n");
+
+ cand.score = 1 / (cand.rot_dots[1].x - cand.rot_dots[0].x);
+
// we have a candidate, store it
WIIUSE_DEBUG("IR: new candidate %d\n",num_candidates);
candidates[num_candidates++] = cand;
@@ -688,19 +691,19 @@ void find_sensorbar(struct ir_t* ir, struct orient_t *orient) {
WIIUSE_DEBUG("IR: found new dot to track\n");
break;
}
+ sb.score = 0;
ir->state = IR_STATE_SINGLE;
} else {
int bestidx = 0;
- float best = 999.0f;
+ float best = 0.0f;
float d;
WIIUSE_DEBUG("IR: finding best candidate\n");
// look for the best candidate
// for now, the formula is simple: pick the one with the smallest distance
for(i=0; i<num_candidates; i++) {
- d = fabsf(candidates[i].rot_dots[0].x - candidates[i].rot_dots[1].x);
- if(d < best) {
+ if(candidates[i].score > best) {
bestidx = i;
- best = d;
+ best = candidates[i].score;
}
}
WIIUSE_DEBUG("IR: best candidate: %d\n",bestidx);

0 comments on commit fa792f3

Please sign in to comment.
Something went wrong with that request. Please try again.