| 128 | void foo(uint8* test) { (void)test; } |
| 129 | |
| 130 | static int SubWrite(EMUFILE* os, SFORMAT *sf) |
| 131 | { |
| 132 | uint32 acc=0; |
| 133 | |
| 134 | while(sf->v) |
| 135 | { |
| 136 | if(sf->s==~0u) //Link to another struct |
| 137 | { |
| 138 | uint32 tmp; |
| 139 | |
| 140 | if(!(tmp=SubWrite(os,(SFORMAT *)sf->v))) |
| 141 | return(0); |
| 142 | acc+=tmp; |
| 143 | sf++; |
| 144 | continue; |
| 145 | } |
| 146 | |
| 147 | acc+=8; //Description + size |
| 148 | acc+=sf->s&(~FCEUSTATE_FLAGS); |
| 149 | |
| 150 | if(os) //Are we writing or calculating the size of this block? |
| 151 | { |
| 152 | os->fwrite(sf->desc,4); |
| 153 | write32le(sf->s&(~FCEUSTATE_FLAGS),os); |
| 154 | |
| 155 | #ifdef FCEU_BIG_ENDIAN |
| 156 | if(sf->s&RLSB) |
| 157 | FlipByteOrder((uint8*)sf->v,sf->s&(~FCEUSTATE_FLAGS)); |
| 158 | #endif |
| 159 | |
| 160 | if(sf->s&FCEUSTATE_INDIRECT) |
| 161 | os->fwrite(*(char **)sf->v,sf->s&(~FCEUSTATE_FLAGS)); |
| 162 | else |
| 163 | os->fwrite((char*)sf->v,sf->s&(~FCEUSTATE_FLAGS)); |
| 164 | |
| 165 | //Now restore the original byte order. |
| 166 | #ifdef FCEU_BIG_ENDIAN |
| 167 | if(sf->s&RLSB) |
| 168 | FlipByteOrder((uint8*)sf->v,sf->s&(~FCEUSTATE_FLAGS)); |
| 169 | #endif |
| 170 | } |
| 171 | sf++; |
| 172 | } |
| 173 | |
| 174 | return(acc); |
| 175 | } |
| 176 | |
| 177 | static int WriteStateChunk(EMUFILE* os, int type, SFORMAT *sf) |
| 178 | { |
no test coverage detected