Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #define Export extern "C" _declspec( dllexport )
- #include <vector>
- typedef unsigned char ubyte;
- typedef signed char sbyte;
- typedef unsigned short uint16;
- typedef signed short sint16;
- typedef unsigned int uint32;
- typedef signed int sint32;
- typedef unsigned long long uint64;
- typedef signed long long sint64;
- typedef float float32;
- typedef double float64;
- typedef bool boolflag;
- ubyte* BytePrism = nullptr;
- uint64 ByteAddress = 0;
- uint32 ByteBuffWidth = 0;
- uint32 ByteBuffHeight = 0;
- uint32 ByteBuffDepth = 0;
- std::vector<uint64> ByteMemory;
- std::vector<uint32> ByteWidth;
- std::vector<uint32> ByteHeight;
- std::vector<uint32> ByteDepth;
- // Creates a Prism and returns it's memory address(for reference).
- Export float64 PrismCreate( uint32 Width , uint32 Height , uint32 Depth ) {
- ubyte* Prism = new ubyte[ Width * Height * Depth ]();
- ByteMemory.push_back( ( uint64 ) Prism );
- ByteWidth.push_back( Width );
- ByteHeight.push_back( Height );
- ByteDepth.push_back( Depth );
- return ( float64 ) ( ( uint64 ) Prism );
- };
- // Deletes a Prism from the specified memory address if the Prism exists.
- Export float64 PrismDelete( float64 Address ) {
- for( uint32 b = 0; b < ByteMemory.size(); b ++ ) {
- if ( ByteMemory.at( b ) == ( uint64 ) Address ) {
- ByteMemory.erase( ByteMemory.begin() + b );
- ByteWidth.erase( ByteWidth.begin() + b );
- ByteHeight.erase( ByteHeight.begin() + b );
- ByteDepth.erase( ByteDepth.begin() + b );
- ByteMemory.shrink_to_fit();
- ByteWidth.shrink_to_fit();
- ByteHeight.shrink_to_fit();
- ByteDepth.shrink_to_fit();
- delete[] ( ( ubyte* ) ( ( uint64 ) Address ) );
- if ( ( uint64 ) Address == ( uint64 ) BytePrism ) {
- BytePrism = nullptr;
- ByteAddress = 0;
- ByteBuffWidth = 0;
- ByteBuffHeight = 0;
- ByteBuffDepth = 0;
- return 2.0;
- };
- return 1.0;
- };
- };
- return 0.0;
- };
- // Sets the system target to the specified Prism if the Prism exists.
- Export float64 PrismTarget( float64 Address ) {
- for( uint32 b = 0; b < ByteMemory.size(); b ++ ) {
- if ( ByteMemory.at( b ) == ( uint64 ) Address ) {
- ByteBuffWidth = ByteWidth.at( b );
- ByteBuffHeight = ByteHeight.at( b );
- ByteBuffDepth = ByteDepth.at( b );
- BytePrism = ( ubyte* ) ( ( uint64 ) Address );
- ByteAddress = ( uint64 ) Address;
- return 1.0;
- };
- };
- return 0.0;
- };
- // Resets the system target to null(no target).
- Export float64 PrismReset( void ) {
- BytePrism = nullptr;
- ByteAddress = 0;
- return 0.0;
- };
- // Returns the total number of cells of the prism.
- Export float64 PrismCells( void ) {
- return ( float64 ) ( ByteBuffWidth * ByteBuffHeight * ByteBuffDepth );
- };
- // Returns either the Width, Height or Depth of the Prism.
- Export float64 PrismDimension( float64 Dimension ) {
- switch( ( uint64 ) Dimension ) {
- case 0:
- //( ( float64 ) ByteBuffWidth );
- return ( ( float64 ) ByteBuffWidth );
- break;
- case 1:
- return ( ( float64 ) ByteBuffHeight );
- break;
- case 2:
- return ( ( float64 ) ByteBuffDepth );
- break;
- default:
- return -1;
- break;
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement