ISO loading, menus, LEDs
[picodrive.git] / Pico / cd / cd_sys.c
index 72d6c0e..833680b 100644 (file)
@@ -1,6 +1,6 @@
 #include <stdio.h>\r
 #include "cd_sys.h"\r
-//#include "cd_file.h"\r
+#include "cd_file.h"\r
 \r
 #include "../PicoInt.h"\r
 \r
 #define FAST_REV       0x10300         // FAST REVERSE track CDD status\r
 #define PLAYING                0x0100          // PLAYING audio track CDD status\r
 \r
-/*\r
-#include "gens.h"\r
-#include "G_dsound.h"\r
-#include "cdda_mp3.h"\r
-#include "lc89510.h"\r
-#include "Star_68k.h"\r
-#include "Mem_M68K.h"\r
-#include "Mem_S68K.h"\r
-#include "save.h"\r
-#include "misc.h"\r
-*/\r
-\r
 \r
 /*\r
 int CDDA_Enable;\r
@@ -45,8 +33,6 @@ static int CDD_Complete;
 \r
 static int File_Add_Delay = 0;\r
 \r
-//_scd SCD;\r
-\r
 \r
 \r
 #define CHECK_TRAY_OPEN                                \\r
@@ -191,9 +177,7 @@ void Check_CD_Command(void)
 \r
                if (File_Add_Delay == 0)\r
                {\r
-#if 0 // TODO\r
                        FILE_Read_One_LBA_CDC();\r
-#endif\r
                }\r
                else File_Add_Delay--;\r
        }\r
@@ -215,9 +199,7 @@ void Check_CD_Command(void)
 \r
 int Init_CD_Driver(void)\r
 {\r
-#if 0 // TODO\r
        FILE_Init();\r
-#endif\r
 \r
        return 0;\r
 }\r
@@ -225,9 +207,7 @@ int Init_CD_Driver(void)
 \r
 void End_CD_Driver(void)\r
 {\r
-#if 0 // TODO\r
        FILE_End();\r
-#endif\r
 }\r
 \r
 \r
@@ -240,33 +220,29 @@ void Reset_CD(void)
 }\r
 \r
 \r
-int Insert_CD(char *buf, char *iso_name)\r
+int Insert_CD(char *iso_name, int is_bin)\r
 {\r
+       int ret = 0;\r
+\r
 //     memset(CD_Audio_Buffer_L, 0, 4096 * 4);\r
 //     memset(CD_Audio_Buffer_R, 0, 4096 * 4);\r
 \r
-       if (iso_name == NULL)\r
-       {\r
-               CD_Present = 0;\r
-       }\r
-       else\r
+       CD_Present = 0;\r
+\r
+       if (iso_name != NULL)\r
        {\r
-#if 0 // TODO\r
-               Load_ISO(buf, iso_name);\r
-               CD_Present = 1;\r
-#endif\r
-               return 0;\r
+               ret = Load_ISO(iso_name, is_bin);\r
+               if (ret == 0)\r
+                       CD_Present = 1;\r
        }\r
 \r
-       return 0;\r
+       return ret;\r
 }\r
 \r
 \r
 void Stop_CD(void)\r
 {\r
-#if 0 // TODO\r
        Unload_ISO();\r
-#endif\r
        CD_Present = 0;\r
 }\r
 \r
@@ -436,7 +412,7 @@ int Get_Total_Lenght_CDD_c23(void)
        Pico_mcd->cdd.Ext = 0;\r
 \r
 // FIXME: remove\r
-Pico_mcd->cdd.Seconde = 2;\r
+//Pico_mcd->cdd.Seconde = 2;\r
 \r
        CDD_Complete = 1;\r
 \r
@@ -462,7 +438,7 @@ int Get_First_Last_Track_CDD_c24(void)
        Pico_mcd->cdd.Ext = 0;\r
 \r
 // FIXME: remove\r
-Pico_mcd->cdd.Minute = Pico_mcd->cdd.Seconde = 1;\r
+//Pico_mcd->cdd.Minute = Pico_mcd->cdd.Seconde = 1;\r
 \r
        CDD_Complete = 1;\r
 \r
@@ -546,9 +522,7 @@ int Play_CDD_c3(void)
        {\r
                Pico_mcd->s68k_regs[0x36] &= ~0x01;                             // AUDIO\r
                //CD_Audio_Starting = 1;\r
-#if 0 // TODO\r
                FILE_Play_CD_LBA();\r
-#endif\r
        }\r
 \r
        if (Pico_mcd->scd.Cur_Track == 100) Pico_mcd->cdd.Minute = 0x0A02;\r
@@ -651,9 +625,7 @@ int Resume_CDD_c7(void)
        {\r
                Pico_mcd->s68k_regs[0x36] &= ~0x01;                             // AUDIO\r
                //CD_Audio_Starting = 1;\r
-#if 0 // TODO\r
                FILE_Play_CD_LBA();\r
-#endif\r
        }\r
 \r
        if (Pico_mcd->scd.Cur_Track == 100) Pico_mcd->cdd.Minute = 0x0A02;\r
@@ -669,7 +641,7 @@ int Resume_CDD_c7(void)
 }\r
 \r
 \r
-int    Fast_Foward_CDD_c8(void)\r
+int Fast_Foward_CDD_c8(void)\r
 {\r
        CHECK_TRAY_OPEN\r
        CHECK_CD_PRESENT\r
@@ -690,7 +662,7 @@ int Fast_Foward_CDD_c8(void)
 }\r
 \r
 \r
-int    Fast_Rewind_CDD_c9(void)\r
+int Fast_Rewind_CDD_c9(void)\r
 {\r
        CHECK_TRAY_OPEN\r
        CHECK_CD_PRESENT\r
@@ -751,9 +723,7 @@ int Open_Tray_CDD_cD(void)
 \r
        Pico_mcd->scd.Status_CDC &= ~1;                 // Stop CDC read\r
 \r
-#if 0 // TODO\r
        Unload_ISO();\r
-#endif\r
        CD_Present = 0;\r
 \r
        Pico_mcd->scd.Status_CDD = TRAY_OPEN;\r