trunk/src/mame/machine/pgmprot_igs027a_type1.c
| r24799 | r24800 | |
| 569 | 569 | |
| 570 | 570 | /* preliminary */ |
| 571 | 571 | |
| 572 | | // fairly accurate now, although could still do with finding a way to verify on hw |
| 572 | // should be correct, note each value only appears once |
| 573 | 573 | UINT8 puzzli2_level_decode[256] = { |
| 574 | 574 | // 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , a , b , c , d , e , f , |
| 575 | 575 | 0x32, 0x3e, 0xb2, 0x37, 0x31, 0x22, 0xd6, 0x0d, 0x35, 0x5c, 0x8d, 0x3c, 0x7a, 0x5f, 0xd7, 0xac, // 0x0 |
| r24799 | r24800 | |
| 607 | 607 | }; |
| 608 | 608 | |
| 609 | 609 | |
| 610 | #define puzzli2_printf logerror |
| 610 | 611 | |
| 611 | | |
| 612 | 612 | void pgm_arm_type1_state::command_handler_puzzli2(int pc) |
| 613 | 613 | { |
| 614 | 614 | |
| r24799 | r24800 | |
| 687 | 687 | |
| 688 | 688 | if (command_31_write_type==2) |
| 689 | 689 | { |
| 690 | | printf("%08x: %02x %04x | ",pc, m_ddp3lastcommand, m_value0); |
| 690 | puzzli2_printf("%08x: %02x %04x | ",pc, m_ddp3lastcommand, m_value0); |
| 691 | 691 | |
| 692 | 692 | // this shouldn't apply to the stuff written on startup, only the level data.. |
| 693 | 693 | |
| r24799 | r24800 | |
| 700 | 700 | hackcount2++; |
| 701 | 701 | m_valueresponse = 0x00d20000; |
| 702 | 702 | |
| 703 | | //printf("(set xor table offset)\n"); |
| 703 | //puzzli2_printf("(set xor table offset)\n"); |
| 704 | 704 | } |
| 705 | 705 | else // how do we decide end? |
| 706 | 706 | { |
| r24799 | r24800 | |
| 715 | 715 | |
| 716 | 716 | //UINT8 tableaddr = (hack_31_table_offset + (hack_31_table_offset2&0xf))&0xff; |
| 717 | 717 | //UINT8 xoredval = m_value0 ^ puzzli2_level_decode[tableaddr]; |
| 718 | | //printf("value %02x, after xor is %02x (table address,value %02x,%02x)\n", m_value0, xoredval, tableaddr, puzzli2_level_decode[tableaddr]); |
| 718 | //puzzli2_printf("value %02x, after xor is %02x (table address,value %02x,%02x)\n", m_value0, xoredval, tableaddr, puzzli2_level_decode[tableaddr]); |
| 719 | 719 | |
| 720 | 720 | hackcount2++; |
| 721 | 721 | hack_31_table_offset2++; |
| r24799 | r24800 | |
| 729 | 729 | |
| 730 | 730 | //UINT8 tableaddr = (hack_31_table_offset + (hack_31_table_offset2&0xf))&0xff; |
| 731 | 731 | //UINT8 xoredval = m_value0 ^ puzzli2_level_decode[tableaddr]; |
| 732 | | //printf("value %02x, after xor is %02x (table address,value %02x,%02x) (end, returning %02x as playfield width)\n", m_value0, xoredval, tableaddr, puzzli2_level_decode[tableaddr], m_valueresponse); |
| 732 | //puzzli2_printf("value %02x, after xor is %02x (table address,value %02x,%02x) (end, returning %02x as playfield width)\n", m_value0, xoredval, tableaddr, puzzli2_level_decode[tableaddr], m_valueresponse); |
| 733 | 733 | |
| 734 | 734 | |
| 735 | 735 | } |
| r24799 | r24800 | |
| 740 | 740 | else |
| 741 | 741 | { |
| 742 | 742 | // todo, responses when uploading the startup values are different |
| 743 | | printf("%08x: %02x %04x (for z80 address?)\n ",pc, m_ddp3lastcommand, m_value0); |
| 743 | puzzli2_printf("%08x: %02x %04x (for z80 address?)\n ",pc, m_ddp3lastcommand, m_value0); |
| 744 | 744 | |
| 745 | 745 | m_valueresponse = 0x00d20000 | p2_31_retcounter; |
| 746 | 746 | p2_31_retcounter++; // returns 0xc for the first one, 0x19 for the last one |
| r24799 | r24800 | |
| 754 | 754 | // the game expects to read back a fully formed level structure from the ARM |
| 755 | 755 | case 0x13: |
| 756 | 756 | { |
| 757 | | printf("%08x: %02x %04x (READ LEVEL DATA) | ",pc, m_ddp3lastcommand, m_value0); |
| 757 | puzzli2_printf("%08x: %02x %04x (READ LEVEL DATA) | ",pc, m_ddp3lastcommand, m_value0); |
| 758 | 758 | |
| 759 | 759 | // this is the how to play screen, correctly returned with current code |
| 760 | 760 | /* |
| r24799 | r24800 | |
| 774 | 774 | if (hackcount==0) |
| 775 | 775 | { |
| 776 | 776 | m_valueresponse = 0x002d0000 | ((depth>>4)+1); // this *seems* to come from upper bits of the first real value written to the device during the level stream (verify, seems wrong for some levels because you get a black bar on the bottom of the screen, but might be bad xors) |
| 777 | | printf("level depth returning %08x\n", m_valueresponse ); |
| 777 | puzzli2_printf("level depth returning %08x\n", m_valueresponse ); |
| 778 | 778 | } |
| 779 | 779 | else if (hackcount<((10*numbercolumns)+1)) |
| 780 | 780 | { |
| 781 | 781 | m_valueresponse = 0x002d0000 | leveldata[hackcount-1]; |
| 782 | | printf("level data returning %08x\n", m_valueresponse ); |
| 782 | puzzli2_printf("level data returning %08x\n", m_valueresponse ); |
| 783 | 783 | } |
| 784 | 784 | else |
| 785 | 785 | { |
| 786 | 786 | hackcount=0; |
| 787 | 787 | m_valueresponse = 0x00740054; // 0x0074 0054 is returned after how to play reads above.. where does 0x54 come from? |
| 788 | | printf("END returning %08x\n", m_valueresponse ); |
| 788 | puzzli2_printf("END returning %08x\n", m_valueresponse ); |
| 789 | 789 | |
| 790 | 790 | } |
| 791 | 791 | |
| r24799 | r24800 | |
| 802 | 802 | |
| 803 | 803 | |
| 804 | 804 | case 0x38: // Reset |
| 805 | | printf("%08x: %02x %04x (RESET)\n",pc, m_ddp3lastcommand, m_value0); |
| 805 | puzzli2_printf("%08x: %02x %04x (RESET)\n",pc, m_ddp3lastcommand, m_value0); |
| 806 | 806 | m_simregion = ioport("Region")->read(); |
| 807 | 807 | m_valueresponse = 0x780000 | m_simregion<<8; // this must also return the cart region or the game will act in odd ways when inserting a coin on continue, or during the game on later levels |
| 808 | 808 | m_valuekey = 0x100; |
| r24799 | r24800 | |
| 817 | 817 | // also some other gfx? |
| 818 | 818 | // logic here seems correct, not sure where the 0x19 and 0x5 etc. come from tho! |
| 819 | 819 | case 0x47: |
| 820 | | printf("%08x: %02x %04x (GFX OFF PART 1)\n",pc, m_ddp3lastcommand, m_value0); |
| 820 | puzzli2_printf("%08x: %02x %04x (GFX OFF PART 1)\n",pc, m_ddp3lastcommand, m_value0); |
| 821 | 821 | |
| 822 | 822 | hack_47_value = m_value0; |
| 823 | 823 | |
| 824 | 824 | //hack_47_value = ((m_value0 & 0x0700)>>8) * 0x19; |
| 825 | 825 | //hack_47_value +=((m_value0 & 0x0007)>>0) * 0x05; |
| 826 | | if (m_value0 & 0xf0f0) printf("unhandled 0x47 bits %04x\n", m_value0); |
| 826 | if (m_value0 & 0xf0f0) puzzli2_printf("unhandled 0x47 bits %04x\n", m_value0); |
| 827 | 827 | |
| 828 | | //printf("0x47 value was %04x - using %04x\n", m_value0, hack_47_value); |
| 828 | //puzzli2_printf("0x47 value was %04x - using %04x\n", m_value0, hack_47_value); |
| 829 | 829 | |
| 830 | 830 | m_valueresponse = 0x00740047; |
| 831 | 831 | |
| 832 | 832 | break; |
| 833 | 833 | |
| 834 | 834 | case 0x52: |
| 835 | | printf("%08x: %02x %04x (GFX OFF PART 2)\n",pc, m_ddp3lastcommand, m_value0); |
| 835 | puzzli2_printf("%08x: %02x %04x (GFX OFF PART 2)\n",pc, m_ddp3lastcommand, m_value0); |
| 836 | 836 | |
| 837 | | //printf("which %04x\n", m_value0); |
| 838 | | if (m_value0 & 0xfff0) printf("unhandled 0x52 bits %04x\n", m_value0); |
| 837 | //puzzli2_printf("which %04x\n", m_value0); |
| 838 | if (m_value0 & 0xfff0) puzzli2_printf("unhandled 0x52 bits %04x\n", m_value0); |
| 839 | 839 | |
| 840 | 840 | // it writes a value of 0x0000 then expects to read back like |
| 841 | 841 | // this for the lower part of the game backgrounds |
| r24799 | r24800 | |
| 861 | 861 | |
| 862 | 862 | |
| 863 | 863 | case 0x61: // ?? |
| 864 | | printf("%08x: %02x %04x\n",pc, m_ddp3lastcommand, m_value0); |
| 864 | puzzli2_printf("%08x: %02x %04x\n",pc, m_ddp3lastcommand, m_value0); |
| 865 | 865 | |
| 866 | 866 | // this command is written before the values used to decrypt the z80 addresses (assumed) are uploaded with command 31 |
| 867 | 867 | command_31_write_type = 1; |
| r24799 | r24800 | |
| 871 | 871 | break; |
| 872 | 872 | |
| 873 | 873 | case 0x41: // ASIC status? |
| 874 | | printf("%08x: %02x %04x (UNK)\n",pc, m_ddp3lastcommand, m_value0); |
| 874 | puzzli2_printf("%08x: %02x %04x (UNK)\n",pc, m_ddp3lastcommand, m_value0); |
| 875 | 875 | |
| 876 | 876 | // this command is written after the values used to decrypt the z80 addresses (assumed) are uploaded with command 31 |
| 877 | 877 | command_31_write_type = 0; |
| r24799 | r24800 | |
| 881 | 881 | break; |
| 882 | 882 | |
| 883 | 883 | case 0x54: // ?? |
| 884 | | printf("%08x: %02x %04x\n",pc, m_ddp3lastcommand, m_value0); |
| 884 | puzzli2_printf("%08x: %02x %04x\n",pc, m_ddp3lastcommand, m_value0); |
| 885 | 885 | |
| 886 | 886 | // this command is written before uploading the compressed level data stream with command 31 |
| 887 | 887 | |
| r24799 | r24800 | |
| 900 | 900 | break; |
| 901 | 901 | |
| 902 | 902 | /* |
| 903 | | these are probably scrambled with some kind of rotating xor? |
| 904 | | note puzzli2 004e == 0016? |
| 905 | | puzzli2s 0051 == 0019? |
| 906 | | maybe... |
| 907 | 903 | |
| 908 | | puzzli2 on startup |
| 904 | puzzli2 on startup (00148a84) puzzli2s on startup (0014cf58) |
| 905 | |
| 906 | (001489f6: 61 0202 0014ceca: 61 0202) |
| 907 | always |
| 908 | : 31 004e a6f7 | : 31 | 0051 14c9 + 26DD2 |
| 909 | : 31 279e 534f | : 31 | 27a0 c121 |
| 910 | : 31 ab5c a7cf | : 31 | ab5f 15a1 |
| 911 | : 31 145f 7054 | : 31 | 1461 de26 |
| 912 | : 31 85a0 7b7f | : 31 | 85a2 e951 |
| 913 | : 31 7003 c5ab | : 31 | 7006 337d |
| 914 | : 31 456d f3aa | : 31 | 4570 617c |
| 909 | 915 | |
| 910 | | 001489f6: 61 0202 |
| 911 | | 00148a84: 31 004e |
| 912 | | 00148acc: 31 a6f7 |
| 913 | | 00148a84: 31 279e |
| 914 | | 00148acc: 31 534f |
| 915 | | 00148a84: 31 ab5c |
| 916 | | 00148acc: 31 a7cf |
| 917 | | 00148a84: 31 145f |
| 918 | | 00148acc: 31 7054 |
| 919 | | 00148a84: 31 85a0 |
| 920 | | 00148acc: 31 7b7f |
| 921 | | |
| 922 | | 00148a84: 31 7003 |
| 923 | | 00148acc: 31 c5ab |
| 924 | | 00148a84: 31 456d |
| 925 | | 00148acc: 31 f3aa |
| 926 | | 00148b34: 41 e2bb |
| 927 | | |
| 928 | | puzzli2 super on startup |
| 929 | | 0014ceca: 61 0202 |
| 930 | | 0014cf58: 31 0051 |
| 931 | | 0014cfa0: 31 14c9 |
| 932 | | 0014cf58: 31 27a0 |
| 933 | | 0014cfa0: 31 c121 |
| 934 | | 0014cf58: 31 ab5f |
| 935 | | 0014cfa0: 31 15a1 |
| 936 | | 0014cf58: 31 1461 |
| 937 | | 0014cfa0: 31 de26 |
| 938 | | 0014cf58: 31 85a2 |
| 939 | | 0014cfa0: 31 e951 |
| 940 | | |
| 941 | | 0014cf58: 31 7006 |
| 942 | | 0014cfa0: 31 337d |
| 943 | | 0014cf58: 31 4570 |
| 944 | | 0014cfa0: 31 617c |
| 945 | | 0014d008: 41 706d |
| 916 | (00148b34: 41 e2bb 0014d008: 41 706d) |
| 946 | 917 | |
| 918 | actual values needed always |
| 919 | 0x001694a8 / 0x0019027a + 26DD2 |
| 920 | 0x0016cfae / 0x00193D80 |
| 921 | 0x0016ebf2 / 0x001959c4 |
| 922 | 0x0016faa8 / 0x0019687a |
| 923 | 0x00174416 / 0x0019b1e8 |
| 924 | |
| 925 | 0x00166178 / 0x0018cf4a |
| 926 | 0x00166e72 / 0x0018dc44 |
| 927 | |
| 928 | as you can see the difference between the values written is always 26dd2, as is the difference between offsets expected |
| 929 | this makes it impossible to know which value is for which address without further tests! |
| 930 | |
| 931 | |
| 947 | 932 | */ |
| 948 | 933 | |
| 949 | 934 | // I think the values returned here must be connected to the values written to command 31 on startup |
| 950 | 935 | // 63/67 are used on startup to get the z80 music at least |
| 951 | 936 | case 0x63: // used as a read address by the 68k code (related to previous uploaded values like cave?) should point at a table of ~0x80 in size? seems to use values as further pointers? |
| 952 | | printf("%08x: %02x %04x (Z80 ADDR PART 1)\n",pc, m_ddp3lastcommand, m_value0); |
| 937 | puzzli2_printf("%08x: %02x %04x (Z80 ADDR PART 1)\n",pc, m_ddp3lastcommand, m_value0); |
| 953 | 938 | |
| 954 | 939 | if (!strcmp(machine().system().name,"puzzli2")) |
| 955 | 940 | { |
| r24799 | r24800 | |
| 975 | 960 | } |
| 976 | 961 | else |
| 977 | 962 | { |
| 978 | | printf("unk case x63\n"); |
| 963 | puzzli2_printf("unk case x63\n"); |
| 979 | 964 | m_valueresponse = 0x00600000; // wrong |
| 980 | 965 | |
| 981 | 966 | } |
| r24799 | r24800 | |
| 1004 | 989 | } |
| 1005 | 990 | else |
| 1006 | 991 | { |
| 1007 | | printf("unk case x63\n"); |
| 992 | puzzli2_printf("unk case x63\n"); |
| 1008 | 993 | m_valueresponse = 0x00600000; // wrong |
| 1009 | 994 | } |
| 1010 | 995 | } |
| 1011 | 996 | break; |
| 1012 | 997 | |
| 1013 | 998 | case 0x67: // used as a read address by the 68k code (related to previous uploaded values like cave?) directly reads ~0xDBE from the address.. |
| 1014 | | printf("%08x: %02x %04x (Z80 ADDR PART 2)\n",pc, m_ddp3lastcommand, m_value0); |
| 999 | puzzli2_printf("%08x: %02x %04x (Z80 ADDR PART 2)\n",pc, m_ddp3lastcommand, m_value0); |
| 1015 | 1000 | |
| 1016 | 1001 | if (!strcmp(machine().system().name,"puzzli2")) |
| 1017 | 1002 | { |
| r24799 | r24800 | |
| 1025 | 1010 | } |
| 1026 | 1011 | else |
| 1027 | 1012 | { |
| 1028 | | printf("unk case x67\n"); |
| 1013 | puzzli2_printf("unk case x67\n"); |
| 1029 | 1014 | m_valueresponse = 0x00400000; // wrong |
| 1030 | 1015 | } |
| 1031 | 1016 | } |
| r24799 | r24800 | |
| 1041 | 1026 | } |
| 1042 | 1027 | else |
| 1043 | 1028 | { |
| 1044 | | printf("unk case x67\n"); |
| 1029 | puzzli2_printf("unk case x67\n"); |
| 1045 | 1030 | m_valueresponse = 0x00600000; // wrong |
| 1046 | 1031 | } |
| 1047 | 1032 | } |
| 1048 | 1033 | break; |
| 1049 | 1034 | |
| 1050 | 1035 | default: |
| 1051 | | printf("%08x: %02x %04x\n",pc, m_ddp3lastcommand, m_value0); |
| 1036 | puzzli2_printf("%08x: %02x %04x\n",pc, m_ddp3lastcommand, m_value0); |
| 1052 | 1037 | |
| 1053 | 1038 | m_valueresponse = 0x74<<16; |
| 1054 | 1039 | break; |
| r24799 | r24800 | |
| 1061 | 1046 | switch (m_ddp3lastcommand) |
| 1062 | 1047 | { |
| 1063 | 1048 | default: |
| 1064 | | printf("%06x command %02x | %04x\n", pc, m_ddp3lastcommand, m_value0); |
| 1049 | puzzli2_printf("%06x command %02x | %04x\n", pc, m_ddp3lastcommand, m_value0); |
| 1065 | 1050 | m_valueresponse = 0x880000; |
| 1066 | 1051 | break; |
| 1067 | 1052 | |
| 1068 | 1053 | case 0xc0: |
| 1069 | | printf("%06x command %02x | %04x\n", pc, m_ddp3lastcommand, m_value0); |
| 1054 | puzzli2_printf("%06x command %02x | %04x\n", pc, m_ddp3lastcommand, m_value0); |
| 1070 | 1055 | m_valueresponse = 0x880000; |
| 1071 | 1056 | break; |
| 1072 | 1057 | |
| r24799 | r24800 | |
| 1885 | 1870 | depth = 0; |
| 1886 | 1871 | m_row_bitmask = 0; |
| 1887 | 1872 | |
| 1888 | | printf("%02x <- table offset\n", datvalue); |
| 1873 | puzzli2_printf("%02x <- table offset\n", datvalue); |
| 1889 | 1874 | tableoffs = datvalue; |
| 1890 | 1875 | tableoffs2 = 0; |
| 1891 | 1876 | stage = 0; |
| r24799 | r24800 | |
| 1909 | 1894 | numbercolumns = (rawvalue & 0x0f); |
| 1910 | 1895 | numbercolumns++; |
| 1911 | 1896 | |
| 1912 | | printf("%02x <- Sizes (level depth %01x) (number of columns %01x)", rawvalue, depth>>4, numbercolumns); |
| 1897 | puzzli2_printf("%02x <- Sizes (level depth %01x) (number of columns %01x)", rawvalue, depth>>4, numbercolumns); |
| 1913 | 1898 | |
| 1914 | 1899 | |
| 1915 | 1900 | if ((depth != 0x80) && (depth != 0x70) && (depth != 0x50)) |
| r24799 | r24800 | |
| 1922 | 1907 | if ((numbercolumns != 0x6) && (numbercolumns != 0x7) && (numbercolumns != 0x8)) |
| 1923 | 1908 | fatalerror("number of columns specified isn't 6,7, or 8"); |
| 1924 | 1909 | |
| 1925 | | printf("\n"); |
| 1910 | puzzli2_printf("\n"); |
| 1926 | 1911 | |
| 1927 | 1912 | } |
| 1928 | 1913 | else if (stage==1) |
| 1929 | 1914 | { |
| 1930 | | printf("%02x <- Number of Entries for this Column (and upper mask) (column is %d) (xor table location is %02x) ", rawvalue, currentcolumn, tableloc); |
| 1915 | puzzli2_printf("%02x <- Number of Entries for this Column (and upper mask) (column is %d) (xor table location is %02x) ", rawvalue, currentcolumn, tableloc); |
| 1931 | 1916 | stage = 2; |
| 1932 | 1917 | entries_left = (rawvalue >> 4); |
| 1933 | 1918 | m_row_bitmask = (rawvalue & 0x0f)<<8; |
| r24799 | r24800 | |
| 1939 | 1924 | |
| 1940 | 1925 | if (num_entries == 0x00) |
| 1941 | 1926 | { |
| 1942 | | printf("0 entries for this column?"); // seems a valid condition based on the data |
| 1927 | puzzli2_printf("0 entries for this column?"); // seems a valid condition based on the data |
| 1943 | 1928 | } |
| 1944 | 1929 | |
| 1945 | 1930 | |
| 1946 | 1931 | |
| 1947 | | printf("\n"); |
| 1932 | puzzli2_printf("\n"); |
| 1948 | 1933 | |
| 1949 | 1934 | |
| 1950 | 1935 | } |
| 1951 | 1936 | else if (stage==2) |
| 1952 | 1937 | { |
| 1953 | | printf("%02x <- Mask value equal to number of entries (xor table location is %02x)", rawvalue, tableloc); |
| 1938 | puzzli2_printf("%02x <- Mask value equal to number of entries (xor table location is %02x)", rawvalue, tableloc); |
| 1954 | 1939 | stage = 3; |
| 1955 | 1940 | |
| 1956 | 1941 | m_row_bitmask |= rawvalue; |
| r24799 | r24800 | |
| 1958 | 1943 | int num_mask_bits = count_bits(m_row_bitmask); |
| 1959 | 1944 | |
| 1960 | 1945 | if (num_mask_bits != num_entries) |
| 1961 | | printf(" error - number of mask bits != number of entries - "); |
| 1946 | puzzli2_printf(" error - number of mask bits != number of entries - "); |
| 1962 | 1947 | |
| 1963 | 1948 | // |
| 1964 | 1949 | if (entries_left == 0) |
| r24799 | r24800 | |
| 1972 | 1957 | coverage[tableloc] = 1; |
| 1973 | 1958 | if (rawvalue!=0) |
| 1974 | 1959 | { |
| 1975 | | printf(" invalid mask after 00 length?"); |
| 1960 | puzzli2_printf(" invalid mask after 00 length?"); |
| 1976 | 1961 | // attempt to correct the table |
| 1977 | 1962 | //new_puzzli2_level_decode[tableloc] = new_puzzli2_level_decode[tableloc] ^ rawvalue; |
| 1978 | 1963 | |
| r24799 | r24800 | |
| 1980 | 1965 | coverage[prev_tablloc] = 1; |
| 1981 | 1966 | if (full_entry!=0) |
| 1982 | 1967 | { |
| 1983 | | printf(" previous value wasn't 0x00"); |
| 1968 | puzzli2_printf(" previous value wasn't 0x00"); |
| 1984 | 1969 | } |
| 1985 | 1970 | |
| 1986 | 1971 | if (currentcolumn==numbercolumns) |
| r24799 | r24800 | |
| 1993 | 1978 | { |
| 1994 | 1979 | if (num_entries> 0xa) |
| 1995 | 1980 | { |
| 1996 | | printf(" more than 10 entries?"); |
| 1981 | puzzli2_printf(" more than 10 entries?"); |
| 1997 | 1982 | } |
| 1998 | 1983 | else |
| 1999 | 1984 | { |
| r24799 | r24800 | |
| 2018 | 2003 | |
| 2019 | 2004 | if (rawvalue!=desired_mask) |
| 2020 | 2005 | { |
| 2021 | | printf(" possible wrong mask?"); |
| 2006 | puzzli2_printf(" possible wrong mask?"); |
| 2022 | 2007 | } |
| 2023 | 2008 | |
| 2024 | 2009 | |
| r24799 | r24800 | |
| 2026 | 2011 | |
| 2027 | 2012 | } |
| 2028 | 2013 | |
| 2029 | | printf("\n"); |
| 2014 | puzzli2_printf("\n"); |
| 2030 | 2015 | |
| 2031 | 2016 | } |
| 2032 | 2017 | else if (stage==3) |
| r24799 | r24800 | |
| 2048 | 2033 | // 110 - renders as a flashing fish you can't catch? glitches game? |
| 2049 | 2034 | // 111 - repeat of other fish type you can't catch... |
| 2050 | 2035 | |
| 2036 | if (rawvalue<=0x10) // regular fish |
| 2037 | { |
| 2038 | int fishtype = rawvalue; |
| 2039 | puzzli2_printf("%02x <- fish type %d", rawvalue, fishtype); |
| 2040 | object_value = 0x0100 + fishtype; |
| 2041 | // 0x110 is a flashy fish? might be glitchy and need a special number.. |
| 2042 | } |
| 2043 | else if (rawvalue<=0x21) // fish in bubbles |
| 2044 | { |
| 2045 | int fishtype = rawvalue - 0x11; |
| 2046 | puzzli2_printf("%02x <- fish in bubble %d", rawvalue, fishtype); |
| 2047 | object_value = 0x0120 + fishtype; |
| 2048 | // 0x130 is a flashy fish? might be glitchy and need a special number.. |
| 2049 | } |
| 2050 | else if (rawvalue<=0x32) // fish in eggs |
| 2051 | { |
| 2052 | int fishtype = rawvalue - 0x22; |
| 2053 | puzzli2_printf("%02x <- fish in egg %d", rawvalue, fishtype); |
| 2054 | object_value = 0x0140 + fishtype; |
| 2055 | // 0x150 is a flashy fish? might be glitchy and need a special number.. |
| 2051 | 2056 | |
| 2052 | | // some of these might be due to bad decrypt values in the table |
| 2053 | | ////////////////////// regular fish group |
| 2054 | | if (rawvalue==0x00) {object_value = 0x0100; printf("%02x <- fish type 0", rawvalue);} |
| 2055 | | else if (rawvalue==0x01) {object_value = 0x0101; printf("%02x <- fish type 1", rawvalue);} |
| 2056 | | else if (rawvalue==0x02) {object_value = 0x0102; printf("%02x <- fish type 2", rawvalue);} |
| 2057 | | else if (rawvalue==0x03) {object_value = 0x0103; printf("%02x <- fish type 3", rawvalue);} |
| 2058 | | else if (rawvalue==0x04) {object_value = 0x0104; printf("%02x <- fish type 4", rawvalue);} |
| 2059 | | else if (rawvalue==0x05) {object_value = 0x0105; printf("%02x <- fish type 5", rawvalue);} |
| 2060 | | else if (rawvalue==0x06) {object_value = 0x0106; printf("%02x <- fish type 6", rawvalue);} |
| 2061 | | else if (rawvalue==0x07) {object_value = 0x0107; printf("%02x <- fish type 7", rawvalue);} |
| 2062 | | else if (rawvalue==0x08) {object_value = 0x0108; printf("%02x <- fish type 8", rawvalue);} // usually used to have the 2nd stripey type in a level |
| 2063 | | // 09? |
| 2064 | | // 0a? |
| 2065 | | else if (rawvalue==0x0b) {object_value = 0x010b; printf("%02x <- unk object ?? 0b", rawvalue);} |
| 2066 | | else if (rawvalue==0x0c) {object_value = 0x010c; printf("%02x <- unk object ?? 0c", rawvalue);} |
| 2067 | | else if (rawvalue==0x0d) {object_value = 0x010d; printf("%02x <- unk object ?? 0d", rawvalue);} |
| 2068 | | else if (rawvalue==0x0e) {object_value = 0x010e; printf("%02x <- unk object ?? 0e", rawvalue);} |
| 2069 | | else if (rawvalue==0x0f) {object_value = 0x010f; printf("%02x <- unk object ?? 0f", rawvalue);} |
| 2070 | | else if (rawvalue==0x10) {object_value = 0x0110; printf("%02x <- unk object ?? 10", rawvalue);} // broken flashy fish thing?? |
| 2071 | | ////////////////////// fish in bubble group |
| 2072 | | else if (rawvalue==0x11) {object_value = 0x0120; printf("%02x <- unk object ?? 11", rawvalue);} // bubble type 0? |
| 2073 | | else if (rawvalue==0x12) {object_value = 0x0121; printf("%02x <- fish in bubble (type 1?)", rawvalue);} |
| 2074 | | else if (rawvalue==0x13) {object_value = 0x0122; printf("%02x <- fish in bubble (type 2?)", rawvalue);} |
| 2075 | | else if (rawvalue==0x14) {object_value = 0x0123; printf("%02x <- fish in bubble (type 3?)??", rawvalue);} |
| 2076 | | else if (rawvalue==0x15) {object_value = 0x0124; printf("%02x <- fish in bubble (type 4?)??", rawvalue);} |
| 2077 | | else if (rawvalue==0x16) {object_value = 0x0125; printf("%02x <- fish in bubble (type 5?)??", rawvalue);} |
| 2078 | | else if (rawvalue==0x17) {object_value = 0x0126; printf("%02x <- fish in bubble (type 6?)", rawvalue);} |
| 2079 | | else if (rawvalue==0x18) {object_value = 0x0127; printf("%02x <- fish in bubble (type 7?)", rawvalue);} |
| 2080 | | else if (rawvalue==0x19) {object_value = 0x0128; printf("%02x <- fish in bubble (type 8?)", rawvalue);} |
| 2081 | | // 1a |
| 2082 | | // 1b |
| 2083 | | // 1c |
| 2084 | | // 1d |
| 2085 | | else if (rawvalue==0x1e) {object_value = 0x012d; printf("%02x <- unk object ?? 1e", rawvalue);} |
| 2086 | | // 1f |
| 2087 | | // 20 |
| 2088 | | else if (rawvalue==0x21) {object_value = 0x0130; printf("%02x <- unk object ?? 21", rawvalue);}// puzzli2 // broken flashy thing in a bubble? |
| 2089 | | ////////////////////// fish in egg group |
| 2090 | | else if (rawvalue==0x22) {object_value = 0x0140; printf("%02x <- fish in egg (type 0)", rawvalue);} |
| 2091 | | else if (rawvalue==0x23) {object_value = 0x0141; printf("%02x <- fish in egg (type 1)", rawvalue);} |
| 2092 | | else if (rawvalue==0x24) {object_value = 0x0142; printf("%02x <- fish in egg (type 2)", rawvalue);} |
| 2093 | | else if (rawvalue==0x25) {object_value = 0x0143; printf("%02x <- fish in egg (type 3)", rawvalue);} |
| 2094 | | else if (rawvalue==0x26) {object_value = 0x0144; printf("%02x <- fish in egg (type 4)", rawvalue);} |
| 2095 | | else if (rawvalue==0x27) {object_value = 0x0145; printf("%02x <- fish in egg (type 5)", rawvalue);} |
| 2096 | | else if (rawvalue==0x28) {object_value = 0x0146; printf("%02x <- fish in egg (type 6)", rawvalue);} |
| 2097 | | else if (rawvalue==0x29) {object_value = 0x0147; printf("%02x <- fish in egg (type 7)", rawvalue);} |
| 2098 | | else if (rawvalue==0x2a) {object_value = 0x0148; printf("%02x <- unk object ?? 2a", rawvalue);} |
| 2099 | | // 2b |
| 2100 | | // 2c |
| 2101 | | // 2d |
| 2102 | | // 2e |
| 2103 | | // 2f |
| 2104 | | // 30 |
| 2105 | | // 31 |
| 2106 | | else if (rawvalue==0x32) {object_value = 0x0150; printf("%02x <- unk object ?? 32", rawvalue);} // puzzli2 // broken flashy thing in an egg? |
| 2107 | | ////////////////////// going to assume these are the hook graphics because other object types are too glitch (verify) (why would these be in a level tho?) |
| 2108 | | else if (rawvalue==0x33) {object_value = 0x0180; printf("%02x <- unk object ?? 33", rawvalue);} // puzzli2 |
| 2109 | | // 34 |
| 2110 | | else if (rawvalue==0x35) {object_value = 0x0182; printf("%02x <- unk object ?? 35", rawvalue);} |
| 2111 | | // 36 |
| 2112 | | // 37 |
| 2113 | | else if (rawvalue==0x38) {object_value = 0x0185; printf("%02x <- unk object ?? 38", rawvalue);} // puzzli2 |
| 2114 | | // 39 |
| 2115 | | // 3a |
| 2116 | | // 3b |
| 2117 | | // 3c |
| 2118 | | // 3d |
| 2119 | | // 3e |
| 2120 | | // 3f |
| 2121 | | // 40 |
| 2122 | | else if (rawvalue==0x41) {object_value = 0x018e; printf("%02x <- unk object ?? 41", rawvalue);} // puzzli2 |
| 2123 | | // 42 |
| 2124 | | else if (rawvalue==0x43) {object_value = 0x0190; printf("%02x <- unk object ?? 43", rawvalue);} // puzzli2 (this would be broken flashy thing on a hook?!) |
| 2057 | } |
| 2058 | else if (rawvalue<=0x43) // fish on hook cases, seem to be base 0x180 |
| 2059 | { |
| 2060 | int fishtype = rawvalue - 0x33; |
| 2061 | puzzli2_printf("%02x <- fish on hook %d", rawvalue, fishtype); |
| 2062 | object_value = 0x0180 + fishtype; |
| 2063 | // 0x190 is a flashy fish? might be glitchy and need a special number.. |
| 2064 | |
| 2065 | } |
| 2125 | 2066 | ////////////////////// special objects follow |
| 2126 | | else if (rawvalue==0xd0) {object_value = 0x0200; printf("%02x <- generic bubbles", rawvalue);} |
| 2067 | else if (rawvalue==0xd0) {object_value = 0x0200; puzzli2_printf("%02x <- generic bubbles", rawvalue);} |
| 2127 | 2068 | |
| 2128 | | else if (rawvalue==0xe0) {object_value = 0x8000; printf("%02x <- solid middle", rawvalue);} |
| 2129 | | else if (rawvalue==0xe1) {object_value = 0x8020; printf("%02x <- solid top slant down", rawvalue);} // solid slant top down |
| 2130 | | else if (rawvalue==0xe2) {object_value = 0x8040; printf("%02x <- solid top slant up", rawvalue);} // solid slant top up |
| 2131 | | else if (rawvalue==0xe3) {object_value = 0x8060; printf("%02x <- solid bottom slant up", rawvalue);} |
| 2132 | | else if (rawvalue==0xe4) {object_value = 0x8080; printf("%02x <- solid bottom slant down", rawvalue);} // sold slant bottom up |
| 2069 | else if (rawvalue==0xe0) {object_value = 0x8000; puzzli2_printf("%02x <- solid middle", rawvalue);} |
| 2070 | else if (rawvalue==0xe1) {object_value = 0x8020; puzzli2_printf("%02x <- solid top slant down", rawvalue);} // solid slant top down |
| 2071 | else if (rawvalue==0xe2) {object_value = 0x8040; puzzli2_printf("%02x <- solid top slant up", rawvalue);} // solid slant top up |
| 2072 | else if (rawvalue==0xe3) {object_value = 0x8060; puzzli2_printf("%02x <- solid bottom slant up", rawvalue);} |
| 2073 | else if (rawvalue==0xe4) {object_value = 0x8080; puzzli2_printf("%02x <- solid bottom slant down", rawvalue);} // sold slant bottom up |
| 2133 | 2074 | |
| 2134 | 2075 | |
| 2135 | | else {object_value = 0xffff; printf("%02x <- unknown object", rawvalue);} |
| 2076 | else {object_value = 0xffff; puzzli2_printf("%02x <- unknown object", rawvalue);} |
| 2136 | 2077 | |
| 2137 | | printf(" (xor table location is %02x)\n",tableloc); |
| 2078 | puzzli2_printf(" (xor table location is %02x)\n",tableloc); |
| 2138 | 2079 | |
| 2139 | 2080 | if (object_value==0xffff) |
| 2140 | 2081 | { |