diff --git a/libn3ds/include/arm11/drivers/codec.h b/libn3ds/include/arm11/drivers/codec.h index 8421d39..172a0e8 100644 --- a/libn3ds/include/arm11/drivers/codec.h +++ b/libn3ds/include/arm11/drivers/codec.h @@ -54,3 +54,10 @@ void CODEC_wakeup(void); * @return Returns true if data was available and false otherwise. */ bool CODEC_getRawAdcData(CdcAdcData *data); + +/** + * @brief Get the headphone connect state + * + * @return Returns true if headphone is connected + */ +u8 CODEC_isHeadsetUsing(void); \ No newline at end of file diff --git a/libn3ds/source/arm11/drivers/codec.c b/libn3ds/source/arm11/drivers/codec.c index f7d949c..da3911e 100644 --- a/libn3ds/source/arm11/drivers/codec.c +++ b/libn3ds/source/arm11/drivers/codec.c @@ -758,3 +758,8 @@ bool CODEC_getRawAdcData(CdcAdcData *data) return false; } + +u8 CODEC_isHeadsetUsing(void) +{ + return readReg(CDC_REG_100_44) & 3u; +} \ No newline at end of file diff --git a/source/arm11/open_agb_firm.c b/source/arm11/open_agb_firm.c index f1719e7..74ea5ae 100644 --- a/source/arm11/open_agb_firm.c +++ b/source/arm11/open_agb_firm.c @@ -40,6 +40,7 @@ #include "arm11/atp.h" #include "kernel.h" #include "kevent.h" +#include "arm11/drivers/codec.h" #define OAF_WORK_DIR "sdmc:/3ds/open_agb_firm" @@ -167,6 +168,7 @@ static atp_error_t config_item( atp_callerdata_t, atp_counter_t index, atp_itemc { const char *scaler_val[] = {"上屏无缩放", "上屏GPU放大", "上屏DMA放大", "下屏无缩放"}; const char *savetype_name[] = {"和卡带序列号一致", "读取ROM的特定标记", "汉化带SRAM补丁", "自行决定"}; + const char *headphone_name[] = {"零", "壹", "贰", "叁"}; static char buf[16]; cfg->extra_text_color = ATP_COLOR_GREEN; if( index == 0 ) @@ -192,6 +194,11 @@ static atp_error_t config_item( atp_callerdata_t, atp_counter_t index, atp_itemc cfg->text = "存档方案"; cfg->extra_text = savetype_name[g_oafConfig.savePolicy]; } + else + { + cfg->text = "耳机状态"; + cfg->extra_text = headphone_name[CODEC_isHeadsetUsing()]; + } cfg->value = index; return ATP_SUCCESS; } @@ -255,7 +262,7 @@ atp_error_t oaf_config_page() title, sizeof(title), "参数配置           当前电量:%3d%%" "每次开机存档方案重置为“和卡带序列号一致”,这个方案会优先使用游戏最后一次启动时设置的存档类型", MCU_getBatteryLevel()); - atp_error_t res = atp_select( title, 4, config_item, config_adjust, NULL, 0, 0, NULL ); + atp_error_t res = atp_select( title, 5, config_item, config_adjust, NULL, 0, 0, NULL ); if( res == ATP_NO_ACTION ) { memcpy( &g_oafConfig, prev, sizeof(g_oafConfig) );