New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

pocket-camera-save-parser

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pocket-camera-save-parser

Parser for Pocket Camera & GameBoy Camera save file

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

pocket-camera-save-parser

Simple parser for GameBoy/Pocket Camera written in typescript

Installation

$ npm install --save pocket-camera-save-parser

TODO

  • Get images from user gallery
  • Get last image seen by the sensor
  • Get game face image
  • Better parser for save meta information(JP&INT)
  • Write documentation for this lib
  • Parse to some image format instead of array of pixels

Usage

Simple script to get photos from save file and print it to cli can looks like

import path from 'path';

import { readFile } from 'node:fs/promises';

import { parseSaveFile, GBPixel, createHexBlob } from 'pocket-camera-save-parser';

const SAVE_FILE_PATH = path.resolve(__dirname, './input/test.sav'); // Path to your save file

type TPallette = [string, string, string, string];

const ASCII_PALLETTE: TPallette = [
  ' ',
  '.',
  ':',
  '+',
];

const renderPixel = (pixel: GBPixel) => ASCII_PALLETTE[pixel];

const loadSaveFileAsBlob = async(path: string) => {
  const data = await readFile(path);

  return createHexBlob(data);
}

const printImagesFromGBSaveInCli = async () => {
  const saveFile = await loadSaveFileAsBlob(SAVE_FILE_PATH);

  const save = await parseSaveFile(saveFile);

  save.photoSlots
    .filter(({ photoIndex }) => photoIndex > 0) // Show only not deleted images
    .map(({ image, photoIndex, slotIndex }) => {
      console.log(`---[IMAGE_ALBUM_INDEX:${photoIndex}]-[MEMORY_SLOT:${String(slotIndex).padStart(2, '0')}]${'-'.repeat(87)}`);

      image.pixels.forEach((line) => {
        console.log(line.map(renderPixel).join(''));
      })
    })
}

printImagesFromGBSaveInCli();


Aknowledgments

  • Raphaël BOICHOT for writing excellent research paper about camera save format.

Keywords

FAQs

Package last updated on 19 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc