On Coin Insert, a file Save/Coin.ini is created if it does not exist, which stores the number of coins currrently in m_iCoins. Whenever m_iCoins is update, the Coin.ini is updated.
On boot, Coin.ini is read and m_iCoins is set to that value. If coins in coin.ini file is greater then MAX_NUM_CREDITS then reset the value to 0.