unit hsc_util

Hi Score Cafe Library for #FujiNet interface.

author: bocianu bocianu@gmail.com


Set of procedures to communicate with Hi Score Cafe server https://xxl.atari.pl/hsc/ using #FujiNet interface on SIO level. https://fujinet.online/
This library is a part of 'blibs' - set of custom Mad-Pascal libraries.
https://gitlab.com/bocianu/blibs

Global Variables:

name:type:description:
boardSizewordNumber of bytes received during last HSC_Get command

Interface:

name:description:
HSC_MakeToken

procedure HSC_MakeToken(id:word;score:cardinal;var hscToken:AOC);


Creates request token consisting game id and score.
    parameters:
  • id - game id in Hi Score Cafe system
  • score - user score
  • hscToken - array of char where the Token is created
HSC_Send

function HSC_Send(var hscToken:AOC;var hscBuffer:AOC):byte;overload;


Sends tokenized user result to Hi Score Cafe server. Function checks if fujinet is present, then checks for autorization token on SD card, and then tries to send user result to HSC.
    parameters:
  • hscToken - array of char where the Token is created
  • hscBuffer - buffer needed to create request query (80 bytes should be enough)
  • returns:
  • (byte) - returns 1 when operation successful. Otherwise returns sio error code.
HSC_Send

function HSC_Send(id:word;score:cardinal;var hscBuffer:AOC):byte;overload;


Sends user result to Hi Score Cafe server. Function checks if fujinet is present, then checks for autorization token on SD card, and then tries to send user result to HSC.
    parameters:
  • id - game id in Hi Score Cafe system
  • score - user score
  • hscBuffer - buffer needed to create request query (80 bytes should be enough)
  • returns:
  • (byte) - returns 1 when operation successful. Otherwise returns sio error code.
HSC_Get_Formated

function HSC_Get_Formated(id:byte;buff:pointer):byte;overload;


Receives screen formated hi score table for specified game, and stores it in buffer. Result is formated as 40 chars aligned text, in ANTIC screen codes. It can be directly written to screen memory.
    parameters:
  • id - game id in Hi Score Cafe system
  • buff - buffer needed to store result (400 bytes for 10 results)
  • returns:
  • (byte) - returns 1 when operation successful. Otherwise returns sio error code.
HSC_Get

function HSC_Get(id:byte;buff:pointer):byte;overload;


Receives hi score table for specified game, and stores it in buffer. Result is a text block, formated as JSON array, in clean ATASCII. It should be parsed by user before displaying.
    parameters:
  • id - game id in Hi Score Cafe system
  • buff - buffer needed to store result (much less than formated one)
  • returns:
  • (byte) - returns 1 when operation successful. Otherwise returns sio error code.