Skip to content

Commit 53a8d98

Browse files
committed
Revert "Merge pull request ps2dev#746 from uyjulian/sio2man_changes_28032025"
This reverts commit ea01978, reversing changes made to d303cd9.
1 parent 12994ed commit 53a8d98

File tree

2 files changed

+32
-58
lines changed

2 files changed

+32
-58
lines changed

iop/system/sio2man/src/exports.tab

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ DECLARE_EXPORT(sio2_data_in)
153153
DECLARE_EXPORT(sio2_stat_set)
154154
DECLARE_EXPORT(sio2_stat_get)
155155
DECLARE_EXPORT(sio2_pad_transfer_init_possiblysdk13x) // originally sio2_pad_transfer_init
156-
DECLARE_EXPORT(sio2_mc_transfer_init_possiblysdk13x) // originally sio2_mc_transfer_init
156+
DECLARE_EXPORT(sio2_pad_transfer_init_possiblysdk13x) // originally sio2_mc_transfer_init
157157
DECLARE_EXPORT(sio2_transfer)
158158
DECLARE_EXPORT(sio2_transfer_reset)
159159
DECLARE_EXPORT(sio2_ctrl_set2)

iop/system/sio2man/src/sio2man.c

Lines changed: 31 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ struct sio2man_internal_data
4040
int m_intr_sema;
4141
int m_transfer_semaphore;
4242
// Unofficial: backwards compatibility for libraries using 1.3 SDK
43-
int m_sdk13x_curflag;
44-
int m_sdk13x_totalflag;
43+
int m_sdk13x_flag;
4544
sio2_mtap_change_slot_cb_t m_mtap_change_slot_cb;
4645
sio2_mtap_get_slot_max_cb_t m_mtap_get_slot_max_cb;
4746
sio2_mtap_get_slot_max2_cb_t m_mtap_get_slot_max2_cb;
@@ -312,14 +311,12 @@ int _start(int ac, char **av)
312311
if ( g_sio2man_data.m_inited )
313312
return 1;
314313
g_sio2man_data.m_inited = 1;
315-
g_sio2man_data.m_sdk13x_curflag = 0;
316-
g_sio2man_data.m_sdk13x_totalflag = 3;
314+
g_sio2man_data.m_sdk13x_flag = 0;
317315
// Unofficial: remove unneeded thread priority argument handler
318-
// Unofficial: use setters instead of setting variable directly
319-
sio2_mtap_change_slot_set(NULL);
320-
sio2_mtap_get_slot_max_set(NULL);
321-
sio2_mtap_get_slot_max2_set(NULL);
322-
sio2_mtap_update_slots_set(NULL);
316+
g_sio2man_data.m_mtap_change_slot_cb = 0;
317+
g_sio2man_data.m_mtap_get_slot_max_cb = 0;
318+
g_sio2man_data.m_mtap_get_slot_max2_cb = 0;
319+
g_sio2man_data.m_mtap_update_slots_cb = 0;
323320
// Unofficial: inlined
324321
sio2_ctrl_set(0x3BC);
325322
CpuSuspendIntr(&state);
@@ -411,7 +408,7 @@ int sio2_transfer(sio2_transfer_data_t *td)
411408
sio2_set_ctrl_1();
412409
sio2_wait_for_intr();
413410
recv_td(td);
414-
if ( g_sio2man_data.m_sdk13x_curflag )
411+
if ( g_sio2man_data.m_sdk13x_flag )
415412
sio2_transfer_reset();
416413
#ifdef SIO2LOG
417414
log_flush(0);
@@ -428,96 +425,73 @@ void sio2_pad_transfer_init(void)
428425
#ifdef SIO2LOG
429426
log_default(LOG_PAD_READY);
430427
#endif
431-
g_sio2man_data.m_sdk13x_curflag = 0;
428+
g_sio2man_data.m_sdk13x_flag = 0;
432429
}
433430

434431
void sio2_pad_transfer_init_possiblysdk13x(void)
435432
{
436433
sio2_pad_transfer_init();
437-
g_sio2man_data.m_sdk13x_curflag |= g_sio2man_data.m_sdk13x_totalflag & 1;
438-
}
439-
440-
void sio2_mc_transfer_init_possiblysdk13x(void)
441-
{
442-
sio2_pad_transfer_init();
443-
g_sio2man_data.m_sdk13x_curflag |= g_sio2man_data.m_sdk13x_totalflag & 2;
434+
g_sio2man_data.m_sdk13x_flag = 1;
444435
}
445436

446437
void sio2_transfer_reset(void)
447438
{
448-
g_sio2man_data.m_sdk13x_curflag = 0;
439+
g_sio2man_data.m_sdk13x_flag = 0;
449440
SignalSema(g_sio2man_data.m_transfer_semaphore);
450441
#ifdef SIO2LOG
451442
log_default(LOG_RESET);
452443
#endif
453444
}
454445

455-
static int sio2_mtap_change_slot_default(s32 *arg)
456-
{
457-
int sum;
458-
int i;
459-
460-
sum = 0;
461-
for ( i = 0; i < 4; i += 1 )
462-
{
463-
arg[i + 4] = ((arg[i] + 1) < 2);
464-
sum += arg[i + 4];
465-
}
466-
return sum == 4;
467-
}
468-
469-
static int sio2_mtap_get_slot_max_default(int port)
470-
{
471-
return 1;
472-
}
473-
474-
static void sio2_mtap_update_slots_default(void) {}
475-
476446
void sio2_mtap_change_slot_set(sio2_mtap_change_slot_cb_t cb)
477447
{
478-
// Unofficial: use default callback if NULL
479-
g_sio2man_data.m_mtap_change_slot_cb = cb ? cb : sio2_mtap_change_slot_default;
448+
g_sio2man_data.m_mtap_change_slot_cb = cb;
480449
}
481450

482451
void sio2_mtap_get_slot_max_set(sio2_mtap_get_slot_max_cb_t cb)
483452
{
484-
// Unofficial: use default callback if NULL
485-
g_sio2man_data.m_mtap_get_slot_max_cb = cb ? cb : sio2_mtap_get_slot_max_default;
453+
g_sio2man_data.m_mtap_get_slot_max_cb = cb;
486454
}
487455

488456
void sio2_mtap_get_slot_max2_set(sio2_mtap_get_slot_max2_cb_t cb)
489457
{
490-
// Unofficial: use default callback if NULL
491-
g_sio2man_data.m_mtap_get_slot_max2_cb = cb ? cb : sio2_mtap_get_slot_max_default;
458+
g_sio2man_data.m_mtap_get_slot_max2_cb = cb;
492459
}
493460

494461
void sio2_mtap_update_slots_set(sio2_mtap_update_slots_t cb)
495462
{
496-
// Unofficial: use default callback if NULL
497-
g_sio2man_data.m_mtap_update_slots_cb = cb ? cb : sio2_mtap_update_slots_default;
463+
g_sio2man_data.m_mtap_update_slots_cb = cb;
498464
}
499465

500466
int sio2_mtap_change_slot(s32 *arg)
501467
{
502-
g_sio2man_data.m_sdk13x_totalflag &= ~g_sio2man_data.m_sdk13x_curflag;
503-
// Unofficial: unconditionally call callback
504-
return g_sio2man_data.m_mtap_change_slot_cb(arg);
468+
int sum;
469+
int i;
470+
471+
g_sio2man_data.m_sdk13x_flag = 0;
472+
if ( g_sio2man_data.m_mtap_change_slot_cb )
473+
return g_sio2man_data.m_mtap_change_slot_cb(arg);
474+
sum = 0;
475+
for ( i = 0; i < 4; i += 1 )
476+
{
477+
arg[i + 4] = ((arg[i] + 1) < 2);
478+
sum += arg[i + 4];
479+
}
480+
return sum == 4;
505481
}
506482

507483
int sio2_mtap_get_slot_max(int port)
508484
{
509-
// Unofficial: unconditionally call callback
510-
return g_sio2man_data.m_mtap_get_slot_max_cb(port);
485+
return g_sio2man_data.m_mtap_get_slot_max_cb ? g_sio2man_data.m_mtap_get_slot_max_cb(port) : 1;
511486
}
512487

513488
int sio2_mtap_get_slot_max2(int port)
514489
{
515-
// Unofficial: unconditionally call callback
516-
return g_sio2man_data.m_mtap_get_slot_max2_cb(port);
490+
return g_sio2man_data.m_mtap_get_slot_max2_cb ? g_sio2man_data.m_mtap_get_slot_max2_cb(port) : 1;
517491
}
518492

519493
void sio2_mtap_update_slots(void)
520494
{
521-
// Unofficial: unconditionally call callback
522-
g_sio2man_data.m_mtap_update_slots_cb();
495+
if ( g_sio2man_data.m_mtap_update_slots_cb )
496+
g_sio2man_data.m_mtap_update_slots_cb();
523497
}

0 commit comments

Comments
 (0)