Author |
Topic: Plugin Pack #1 (Read 163 times) |
|
Admin
Administrator
    
member is offline


Gender: 
Posts: 1961
|
 |
Plugin Pack #1
« Thread started on: Apr 14th, 2009, 12:49pm » |
|
Ok, I am working on the first plugin pack to make it compatible with BPL 2009. It wont be released with BPL 2009, but shortly after. I need suggestions about what you would like to see in it.
At the minute it is mainly a console plugin. It gives you control over the console. Here is a list of what the commands do:
-Open console
-Close console
-Print to the console
-Wait for keys to be pressed
-Ask user for input
-Set console background and foreground colours
-Clear the console
-Position text in console
Your suggestions dont have to be suggestions to do with the console
thanks
|
|
Logged
|
BPL - The legendary programming language created by Ashley & Tom ! ! !
|
|
|
JosephE
Guest
|
 |
Re: Plugin Pack #1
« Reply #1 on: Apr 14th, 2009, 5:35pm » |
|
Are you referring to a DOS-like console?
Does BPL translate this to batch code, like feather did?
|
|
Logged
|
|
|
|
Admin
Administrator
    
member is offline


Gender: 
Posts: 1961
|
 |
Re: Plugin Pack #1
« Reply #2 on: Apr 14th, 2009, 5:44pm » |
|
Yes a dos like console, however it doesn't create a batch file, it uses a dll I an working on to control the console, I will post some screenshots soon.
|
|
Logged
|
BPL - The legendary programming language created by Ashley & Tom ! ! !
|
|
|
Admin
Administrator
    
member is offline


Gender: 
Posts: 1961
|
 |
Re: Plugin Pack #1
« Reply #4 on: Apr 15th, 2009, 9:16pm » |
|
I am not a huge fan of the console either but some people find it useful. It wont just be console commands however many will be.
|
|
Logged
|
BPL - The legendary programming language created by Ashley & Tom ! ! !
|
|
|
iFlex - Cobix
BPL Expert
    
member is offline

Creator of unrigstered charity www.phpro.co.uk

Gender: 
Posts: 136
|
 |
Re: Plugin Pack #1
« Reply #5 on: Apr 25th, 2009, 08:29am » |
|
If you give a stater pack of plugins for free , say a taster of the real thing and they can pay you for the full ones.
|
|
Logged
|
Im back - Try my web design forum - www.jacksonmedia.org.uk
|
|
|
Admin
Administrator
    
member is offline


Gender: 
Posts: 1961
|
 |
Re: Plugin Pack #1
« Reply #6 on: Apr 25th, 2009, 12:53pm » |
|
I was thinking if doing this because we are selling BPL 2009 Pro
|
|
Logged
|
BPL - The legendary programming language created by Ashley & Tom ! ! !
|
|
|
iFlex - Cobix
BPL Expert
    
member is offline

Creator of unrigstered charity www.phpro.co.uk

Gender: 
Posts: 136
|
 |
Re: Plugin Pack #1
« Reply #7 on: Apr 25th, 2009, 10:12pm » |
|
ok
|
|
Logged
|
Im back - Try my web design forum - www.jacksonmedia.org.uk
|
|
|
Dariusc123456
Senior Member
   
member is offline


Posts: 44
|
 |
Re: Plugin Pack #1
« Reply #8 on: Apr 29th, 2009, 10:06pm » |
|
Well just to ask, will it allow you to pack other files into one file, and maybe compress it? I can help out a bit. i have my hands working the computer, I forgot about everything.
|
|
Logged
|
|
|
|
Admin
Administrator
    
member is offline


Gender: 
Posts: 1961
|
 |
Re: Plugin Pack #1
« Reply #9 on: Apr 29th, 2009, 10:13pm » |
|
The compiler I have made for BPL packs all tke, tkn, sll and dll files into the exe, with optional compression, so yes there is packing and compression.
Whenever we release the Beta you will see how the compiler works and then you can see if you know a better way.
The beta will be out soon by the way, sorry about the delay.
|
|
Logged
|
BPL - The legendary programming language created by Ashley & Tom ! ! !
|
|
|
rdp
Full Member
  
member is offline


Posts: 20
|
 |
Re: Plugin Pack #1
« Reply #10 on: Apr 30th, 2009, 2:14pm » |
|
All the files in on exe is greet. bud as in the code, additional files are eg \ bmp to store the bitmapbuttons can that?
|
|
Logged
|
|
|
|
Admin
Administrator
    
member is offline


Gender: 
Posts: 1961
|
 |
Re: Plugin Pack #1
« Reply #11 on: Apr 30th, 2009, 4:07pm » |
|
You cant pack bmp files at the minute, however this may be something we could look into in a future update. The only files that are packed are those predetermined by the compiler, no additional files can be packed at the moment.
|
|
Logged
|
BPL - The legendary programming language created by Ashley & Tom ! ! !
|
|
|
Dariusc123456
Senior Member
   
member is offline


Posts: 44
|
 |
Re: Plugin Pack #1
« Reply #12 on: Jun 7th, 2009, 3:36pm » |
|
This is not good, but it good for most developers:
This code is made in C for packing different files into one. It support SHA-1 hashing algorithm. Dont worry much about the struct, for I will remake it to read to verify the file propperly.
io.h Code:
struct {
char *signature;
char *name[1024];
char *block[1024];
char *hash[1024];
int size[1024];
int len[1024];
int pos;
} ctx;
#define PACK_WRITE 1
#define PACK_READ 2
int FileInit(char *, char *,int);
int FileWriteFile(char *, int);
int FileRead(int);
int FileTerm(void);
io.c Code:#include "io.h"
#include "sha1.h"
#include <stdio.h>
#include <pspsdk.h>
FILE *fd;
int FileInit(char *file, char *header, int mode){
int version;
if(mode == 1){
fd = fopen(file, "wb");
version = 100;
fwrite(header, 1, strlen(header), fd);
fwrite(&version, 1, 4, fd);
}else{
fd = fopen(file, "rb");
char *sig = malloc(strlen(header));
fread(sig, 1, strlen(header), fd);
fread(&version, 1, 4, fd);
}
return 1;
}
int p;
int FileWriteFile(char *file, int pos){
p += pos;
int len = strlen(file);
fseek(fd, p, SEEK_CUR);
fwrite(&len, 1, 4, fd);
fwrite(file, 1, strlen(file), fd);
FILE *in = fopen(file, "rb");
fseek(in, 0, SEEK_END);
int size = ftell(in);
fseek(in, 0, SEEK_SET);
char *buf = malloc(size);
fread(buf, 1, size, in);
fclose(in);
fseek(fd, p, SEEK_CUR);
unsigned char *hash[20];
sha1((unsigned char *)hash, (const unsigned char *)buf, strlen(buf));
fwrite(hash, 1, 20, fd);
fwrite(&size, 1, 4, fd);
fwrite(buf, 1, size, fd);
return 1;
}
int count;
int FileRead(int pos){
p += pos;
count += 1;
fseek(fd, p, SEEK_CUR);
fread(&ctx.len[count], 1, 4, fd);
ctx.name[count] = malloc(ctx.len[count]);
fread(ctx.name[count], 1, ctx.len[count], fd);
fseek(fd, p, SEEK_CUR);
ctx.hash[count] = malloc(20);
fread(ctx.hash[count], 1, 20, fd);
fread(&ctx.size[count], 1, 4, fd);
ctx.block[count] = malloc(ctx.size[count]);
fread(ctx.block[count], 1, ctx.size[count], fd);
}
int FileTerm(void){
fclose(fd);
return 1;
}
sha1.h Code:/*
---------------------------------------------------------------------------
Copyright (c) 2002, Dr Brian Gladman, Worcester, UK. All rights reserved.
LICENSE TERMS
The free distribution and use of this software in both source and binary
form is allowed (with or without changes) provided that:
1. distributions of this source code include the above copyright
notice, this list of conditions and the following disclaimer;
2. distributions in binary form include the above copyright
notice, this list of conditions and the following disclaimer
in the documentation and/or other associated materials;
3. the copyright holder's name is not used to endorse products
built using this software without specific written permission.
ALTERNATIVELY, provided that this notice is retained in full, this product
may be distributed under the terms of the GNU General Public License (GPL),
in which case the provisions of the GPL apply INSTEAD OF those given above.
DISCLAIMER
This software is provided 'as is' with no explicit or implied warranties
in respect of its properties, including, but not limited to, correctness
and/or fitness for purpose.
---------------------------------------------------------------------------
Issue Date: 26/08/2003
*/
#ifndef _SHA1_H
#define _SHA1_H
#include <limits.h>
#define SHA1_BLOCK_SIZE 64
#define SHA1_DIGEST_SIZE 20
#if defined(__cplusplus)
extern "C"
{
#endif
/* define an unsigned 32-bit type */
#if defined(_MSC_VER)
typedef unsigned long sha1_32t;
#elif defined(ULONG_MAX) && ULONG_MAX == 0xfffffffful
typedef unsigned long sha1_32t;
#elif defined(UINT_MAX) && UINT_MAX == 0xffffffff
typedef unsigned int sha1_32t;
#else
# error Please define sha1_32t as an unsigned 32 bit type in sha1.h
#endif
/* type to hold the SHA256 context */
typedef struct
{ sha1_32t count[2];
sha1_32t hash[5];
sha1_32t wbuf[16];
} sha1_ctx;
/* Note that these prototypes are the same for both bit and */
/* byte oriented implementations. However the length fields */
/* are in bytes or bits as appropriate for the version used */
/* and bit sequences are input as arrays of bytes in which */
/* bit sequences run from the most to the least significant */
/* end of each byte */
void sha1_compile(sha1_ctx ctx[1]);
void sha1_begin(sha1_ctx ctx[1]);
void sha1_hash(const unsigned char data[], unsigned long len, sha1_ctx ctx[1]);
void sha1_end(unsigned char hval[], sha1_ctx ctx[1]);
void sha1(unsigned char hval[], const unsigned char data[], unsigned long len);
#if defined(__cplusplus)
}
#endif
#endif
|
|
Logged
|
|
|
|
Dariusc123456
Senior Member
   
member is offline


Posts: 44
|
 |
Re: Plugin Pack #1
« Reply #13 on: Jun 7th, 2009, 3:37pm » |
|
sha1.c Code:/*
---------------------------------------------------------------------------
Copyright (c) 2002, Dr Brian Gladman, Worcester, UK. All rights reserved.
LICENSE TERMS
The free distribution and use of this software in both source and binary
form is allowed (with or without changes) provided that:
1. distributions of this source code include the above copyright
notice, this list of conditions and the following disclaimer;
2. distributions in binary form include the above copyright
notice, this list of conditions and the following disclaimer
in the documentation and/or other associated materials;
3. the copyright holder's name is not used to endorse products
built using this software without specific written permission.
ALTERNATIVELY, provided that this notice is retained in full, this product
may be distributed under the terms of the GNU General Public License (GPL),
in which case the provisions of the GPL apply INSTEAD OF those given above.
DISCLAIMER
This software is provided 'as is' with no explicit or implied warranties
in respect of its properties, including, but not limited to, correctness
and/or fitness for purpose.
---------------------------------------------------------------------------
Issue Date: 18/06/2004
This is a byte oriented version of SHA1 that operates on arrays of bytes
stored in memory.
*/
#include <string.h> /* for memcpy() etc. */
#include <stdlib.h> /* for _lrotl with VC++ */
#include "sha1.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#if defined(__cplusplus)
extern "C"
{
#endif
/*
To obtain the highest speed on processors with 32-bit words, this code
needs to determine the order in which bytes are packed into such words.
The following block of code is an attempt to capture the most obvious
ways in which various environemnts specify their endian definitions.
It may well fail, in which case the definitions will need to be set by
editing at the points marked **** EDIT HERE IF NECESSARY **** below.
*/
/* PLATFORM SPECIFIC INCLUDES */
#define BRG_LITTLE_ENDIAN 1234 /* byte 0 is least significant (i386) */
#define BRG_BIG_ENDIAN 4321 /* byte 0 is most significant (mc68k) */
#ifdef WORDS_BIGENDIAN
#define PLATFORM_BYTE_ORDER BRG_BIG_ENDIAN
#else
#define PLATFORM_BYTE_ORDER BRG_LITTLE_ENDIAN
#endif
#ifdef _MSC_VER
#pragma intrinsic(memcpy)
#endif
#if 0 && defined(_MSC_VER)
#define rotl32 _lrotl
#define rotr32 _lrotr
#else
#define rotl32(x,n) (((x) << n) | ((x) >> (32 - n)))
#define rotr32(x,n) (((x) >> n) | ((x) << (32 - n)))
#endif
#if !defined(bswap_32)
#define bswap_32(x) ((rotr32((x), 24) & 0x00ff00ff) | (rotr32((x), 8) & 0xff00ff00))
#endif
#if (PLATFORM_BYTE_ORDER == BRG_LITTLE_ENDIAN)
#define SWAP_BYTES
#else
#undef SWAP_BYTES
#endif
#if defined(SWAP_BYTES)
#define bsw_32(p,n) \
{ int _i = (n); while(_i--) ((sha1_32t*)p)[_i] = bswap_32(((sha1_32t*)p)[_i]); }
#else
#define bsw_32(p,n)
#endif
#define SHA1_MASK (SHA1_BLOCK_SIZE - 1)
#if 0
#define ch(x,y,z) (((x) & (y)) ^ (~(x) & (z)))
#define parity(x,y,z) ((x) ^ (y) ^ (z))
#define maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z)))
#else /* Discovered by Rich Schroeppel and Colin Plumb */
#define ch(x,y,z) ((z) ^ ((x) & ((y) ^ (z))))
#define parity(x,y,z) ((x) ^ (y) ^ (z))
#define maj(x,y,z) (((x) & (y)) | ((z) & ((x) ^ (y))))
#endif
/* Compile 64 bytes of hash data into SHA1 context. Note */
/* that this routine assumes that the byte order in the */
/* ctx->wbuf[] at this point is in such an order that low */
/* address bytes in the ORIGINAL byte stream will go in */
/* this buffer to the high end of 32-bit words on BOTH big */
/* and little endian systems */
#ifdef ARRAY
#define q(v,n) v[n]
#else
#define q(v,n) v##n
#endif
#define one_cycle(v,a,b,c,d,e,f,k,h) \
q(v,e) += rotr32(q(v,a),27) + \
f(q(v,b),q(v,c),q(v,d)) + k + h; \
q(v,b) = rotr32(q(v,b), 2)
#define five_cycle(v,f,k,i) \
one_cycle(v, 0,1,2,3,4, f,k,hf(i )); \
one_cycle(v, 4,0,1,2,3, f,k,hf(i+1)); \
one_cycle(v, 3,4,0,1,2, f,k,hf(i+2)); \
one_cycle(v, 2,3,4,0,1, f,k,hf(i+3)); \
one_cycle(v, 1,2,3,4,0, f,k,hf(i+4))
void sha1_compile(sha1_ctx ctx[1])
{ sha1_32t *w = ctx->wbuf;
#ifdef ARRAY
sha1_32t v[5];
memcpy(v, ctx->hash, 5 * sizeof(sha1_32t));
#else
sha1_32t v0, v1, v2, v3, v4;
v0 = ctx->hash[0]; v1 = ctx->hash[1];
v2 = ctx->hash[2]; v3 = ctx->hash[3];
v4 = ctx->hash[4];
#endif
#define hf(i) w[i]
five_cycle(v, ch, 0x5a827999, 0);
five_cycle(v, ch, 0x5a827999, 5);
five_cycle(v, ch, 0x5a827999, 10);
one_cycle(v,0,1,2,3,4, ch, 0x5a827999, hf(15)); \
#undef hf
#define hf(i) (w[(i) & 15] = rotl32( \
w[((i) + 13) & 15] ^ w[((i) + 8) & 15] \
^ w[((i) + 2) & 15] ^ w[(i) & 15], 1))
one_cycle(v,4,0,1,2,3, ch, 0x5a827999, hf(16));
one_cycle(v,3,4,0,1,2, ch, 0x5a827999, hf(17));
one_cycle(v,2,3,4,0,1, ch, 0x5a827999, hf(18));
one_cycle(v,1,2,3,4,0, ch, 0x5a827999, hf(19));
five_cycle(v, parity, 0x6ed9eba1, 20);
five_cycle(v, parity, 0x6ed9eba1, 25);
five_cycle(v, parity, 0x6ed9eba1, 30);
five_cycle(v, parity, 0x6ed9eba1, 35);
five_cycle(v, maj, 0x8f1bbcdc, 40);
five_cycle(v, maj, 0x8f1bbcdc, 45);
five_cycle(v, maj, 0x8f1bbcdc, 50);
five_cycle(v, maj, 0x8f1bbcdc, 55);
five_cycle(v, parity, 0xca62c1d6, 60);
five_cycle(v, parity, 0xca62c1d6, 65);
five_cycle(v, parity, 0xca62c1d6, 70);
five_cycle(v, parity, 0xca62c1d6, 75);
#ifdef ARRAY
ctx->hash[0] += v[0]; ctx->hash[1] += v[1];
ctx->hash[2] += v[2]; ctx->hash[3] += v[3];
ctx->hash[4] += v[4];
#else
ctx->hash[0] += v0; ctx->hash[1] += v1;
ctx->hash[2] += v2; ctx->hash[3] += v3;
ctx->hash[4] += v4;
#endif
}
void sha1_begin(sha1_ctx ctx[1])
{
ctx->count[0] = ctx->count[1] = 0;
ctx->hash[0] = 0x67452301;
ctx->hash[1] = 0xefcdab89;
ctx->hash[2] = 0x98badcfe;
ctx->hash[3] = 0x10325476;
ctx->hash[4] = 0xc3d2e1f0;
}
/* SHA1 hash data in an array of bytes into hash buffer and */
/* call the hash_compile function as required. */
void sha1_hash(const unsigned char data[], unsigned long len, sha1_ctx ctx[1])
{ sha1_32t pos = (sha1_32t)(ctx->count[0] & SHA1_MASK),
space = SHA1_BLOCK_SIZE - pos;
const unsigned char *sp = data;
if((ctx->count[0] += len) < len)
++(ctx->count[1]);
while(len >= space) /* tranfer whole blocks if possible */
{
memcpy(((unsigned char*)ctx->wbuf) + pos, sp, space);
sp += space; len -= space; space = SHA1_BLOCK_SIZE; pos = 0;
bsw_32(ctx->wbuf, SHA1_BLOCK_SIZE >> 2);
sha1_compile(ctx);
}
memcpy(((unsigned char*)ctx->wbuf) + pos, sp, len);
}
/* SHA1 final padding and digest calculation */
void sha1_end(unsigned char hval[], sha1_ctx ctx[1])
{ sha1_32t i = (sha1_32t)(ctx->count[0] & SHA1_MASK);
/* put bytes in the buffer in an order in which references to */
/* 32-bit words will put bytes with lower addresses into the */
/* top of 32 bit words on BOTH big and little endian machines */
bsw_32(ctx->wbuf, (i + 3) >> 2);
/* we now need to mask valid bytes and add the padding which is */
/* a single 1 bit and as many zero bits as necessary. Note that */
/* we can always add the first padding byte here because the */
/* buffer always has at least one empty slot */
ctx->wbuf[i >> 2] &= 0xffffff80 << 8 * (~i & 3);
ctx->wbuf[i >> 2] |= 0x00000080 << 8 * (~i & 3);
/* we need 9 or more empty positions, one for the padding byte */
/* (above) and eight for the length count. If there is not */
/* enough space, pad and empty the buffer */
if(i > SHA1_BLOCK_SIZE - 9)
{
if(i < 60) ctx->wbuf[15] = 0;
sha1_compile(ctx);
i = 0;
}
else /* compute a word index for the empty buffer positions */
i = (i >> 2) + 1;
while(i < 14) /* and zero pad all but last two positions */
ctx->wbuf[i++] = 0;
/* the following 32-bit length fields are assembled in the */
/* wrong byte order on little endian machines but this is */
/* corrected later since they are only ever used as 32-bit */
/* word values. */
ctx->wbuf[14] = (ctx->count[1] << 3) | (ctx->count[0] >> 29);
ctx->wbuf[15] = ctx->count[0] << 3;
sha1_compile(ctx);
/* extract the hash value as bytes in case the hash buffer is */
/* misaligned for 32-bit words */
for(i = 0; i < SHA1_DIGEST_SIZE; ++i)
hval[i] = (unsigned char)(ctx->hash[i >> 2] >> (8 * (~i & 3)));
}
void sha1(unsigned char hval[], const unsigned char data[], unsigned long len)
{ sha1_ctx cx[1];
sha1_begin(cx); sha1_hash(data, len, cx); sha1_end(hval, cx);
}
#if defined(__cplusplus)
}
#endif
Use these to make files into one, but take note that this dont protect your file, or compress the file while its being place into a different file.
|
|
Logged
|
|
|
|
Admin
Administrator
    
member is offline


Gender: 
Posts: 1961
|
 |
Re: Plugin Pack #1
« Reply #14 on: Jun 7th, 2009, 3:41pm » |
|
Thanks
|
|
Logged
|
BPL - The legendary programming language created by Ashley & Tom ! ! !
|
|
|
|